insert file in folder google drive

Viewed 246

I want to insert file in folder, after searching in this page , i try to do it

there is my code :

'folder creation
Dim dossier = New Google.Apis.Drive.v2.Data.File()
dossier.Title = dat_sauv.SelectedItem
dossier.MimeType = "application/vnd.google-apps.folder"
Dim rep = Service.Files.Insert(dossier)
rep.Fields = "id"

Dim ref As New ParentReference()
ref.Id = dossier.Id
MessageBox.Show(dossier.Id)
Dim file = rep.Execute()
' file creation
Dim f As New Google.Apis.Drive.v2.Data.File()
f.Title = fichier_txt.Text
f.Description = " fichier drive"
f.MimeType = "text/plain , image/jpeg"
Dim s As Integer
s = f.Id

Try
    Dim r = Service.Parents.Insert(ref, s).Execute()

Catch ex As Exception
    MessageBox.Show(ex.Message)
End Try

but the error is :

enter image description here

and i can't resolve this error. and when i change the type of s to string , the error message is :

enter image description here

1 Answers
Related