Upload and replace file in given folder on Google Docs using .net api

試著忘記壹切 提交于 2019-12-23 05:35:23

问题


I'm trying to upload a file to a given folder using the .net client for google-api. I can do this using:

service = new DocumentsService("SRDUploader");
DocumentEntry lastUploadEntry = service.UploadDocument(file, null );

That works fine, but I need to more things:

  1. How can I specifying the destination folder (tried with "\My folder\file.txt" as secound arg)?
  2. How can I specify that I wan't to overwrite the existing file?

I'm using version 2 version of the .net client api. Maybe there's another version?

Thanks for any help

Larsi


回答1:


DocumentEntry parent = ....;
DocumentEntry deleting = ....;

deleting.Delete();

string feed = string.Format(DocumentsListQuery.foldersUriTemplate, parent.ResourceId);
// http://docs.google.com/feeds/default/private/full/{0}/contents

var result = service.Insert(new Uri(feed), fileStream, fileExtension, fileName);


来源:https://stackoverflow.com/questions/4780743/upload-and-replace-file-in-given-folder-on-google-docs-using-net-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!