如何使用Google API v3将文件上传到(共享驱动器)?

时间:2019-08-27 14:44:50

标签: c# google-api

如何使用C#使用google api v3将文件或文件夹上传到(共享驱动器)?

  

我尝试了此操作,但无法正常工作,但仍上传到了我的驱动器中,而不是共享驱动器

var Folder = new Google.Apis.Drive.v3.Data.File()
{
    Name = fName,
    MimeType = "application/vnd.google-apps.folder",
    DriveId=driveID
};


Google.Apis.Drive.v3.Data.File result = new Google.Apis.Drive.v3.Data.File();
var request = service.Files.Create(Folder);

request.Fields = "name,id,webViewLink";
request.SupportsAllDrives = true;
result = request.Execute();

Console.WriteLine("'" + Folder.Name + "' folder created");

1 个答案:

答案 0 :(得分:0)

我写了Parents = new List<string> { driveID } 而不是DriveId=driveID并有效