Google drive api 如何使用C将文件上载到Google drive中的特定文件夹#
我有一个文件夹ID和一个应该上传到gDrive文件夹的文件。我尝试了以下方法:Google drive api 如何使用C将文件上载到Google drive中的特定文件夹#,google-drive-api,Google Drive Api,我有一个文件夹ID和一个应该上传到gDrive文件夹的文件。我尝试了以下方法: File body = new File(); body.Title = titulo; // titulo is a string that contains the tittle of the file body.Description = descripcion; // the description, it is a string as well body.MimeType = setMimetype(rut
File body = new File();
body.Title = titulo; // titulo is a string that contains the tittle of the file
body.Description = descripcion; // the description, it is a string as well
body.MimeType = setMimetype(rutaArchivo); // and this is a method that sets the mimetype according to the file extension.`
我尝试使用
body.Parents
,但我运气不佳,body.Parents.add
不仅收到字符串(我试图给出包含gdrive文件夹id的字符串),而且我不太理解有关家长的文档。插入您应该添加家长引用(您非常接近):
body.Parents=新列表()
{new ParentReference(){Id=parentId}};
其中parentId
是父级的字符串文件ID。非常感谢。在我看来,这更多的是因为我缺乏知识。非常感谢!
body.Parents = new List<ParentReference>()
{new ParentReference() {Id = parentId}};