上传并使用.NET API定文件夹中替换谷歌文档文件 [英] Upload and replace file in given folder on Google Docs using .net api
本文介绍了上传并使用.NET API定文件夹中替换谷歌文档文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图将文件上载到使用.NET客户端谷歌-API给定文件夹。我可以用这个做的:
服务=新DocumentsService(SRDUploader);
DocumentEntry lastUploadEntry = service.UploadDocument(文件,NULL);
这工作得很好,但我需要更多的东西:
- 如何指定目标文件夹(试图用\我的文件夹\ file.txt的为谢胜利ARG)?
- 如何指定我wan't覆盖现有文件?
我使用版本2 版本的.NET客户端API。也许有另一个版本?
感谢您的帮助
Larsi
解决方案
DocumentEntry父= ....;
DocumentEntry删除= ......;
deleting.Delete();
串料=的String.Format(DocumentsListQuery.foldersUriTemplate,parent.ResourceId);
// http://docs.google.com/feeds/default/private/full/{0}/contents
VAR的结果= service.Insert(新的URI(饲料),文件流,fileExtension,文件名);
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:
- How can I specifying the destination folder (tried with "\My folder\file.txt" as secound arg)?
- 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
解决方案
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);
这篇关于上传并使用.NET API定文件夹中替换谷歌文档文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文