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()是正确的,我做它用错了地方 –