In my application with vb.net , i managed to create folder and subfolder , file , but my problem is when i create subfolder ,file (in folder parent) , i found my subfolder in drive and in folder parent (i found it twice and i want it only in folder parent )
here is my code
Public Function subfolder_creation(id_sub As String) As String
Dim subfolder As New Google.Apis.Drive.v2.Data.File()
subfolder.Title = VF.Text
subfolder.MimeType = "application/vnd.google-apps.folder"
Dim ref = Service.Files.Insert(subfolder)
MessageBox.Show("sous dossier crée")
ref.Fields = "id"
Dim a = ref.Execute()
MessageBox.Show(" Id Subfolder " & a.Id)
Dim reference = New ParentReference()
reference.Id = id_sub
Dim insert = Service.Parents.Insert(reference, a.Id).Execute
MessageBox.Show("Création sous dossier avec succés")
Dim reference_file = New ParentReference()
reference_file.Id = a.Id
UploadFile(reference_file.Id)
Return (a.Id)
i know the problem is from two insert instruction , but i don't know how i solve it
I cant test vb but you should be able to do it all in one request
Add the parent to the body of the insert of the sub folder. In theory you should be able to patch the sub folder with the parent after the insert but its kind of over kill IMO. Just do it when you insert it.