3
我要插入的文件夾中的文件,在這個page搜索後,我嘗試做插入文件
有我的代碼:
'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
但錯誤是:
我無法解決此錯誤。 當我改變S的類型爲字符串,該錯誤信息是:
感謝你的幫助,在谷歌驅動器的文件夾沒有擴展 但是,我找到了解決方案,它的工作,我沒有做ParentReference()是正確的,我做它用錯了地方 –