Google文件。我需要使用公共链接C#编辑文档 [英] Google documents. I need to edit a document with public link c#

查看:91
本文介绍了Google文件。我需要使用公共链接C#编辑文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google文档。我需要在c#中使用公共链接编辑文档。

Google documents. I need edit a document with puplic link in c#. Is there anyway?

FileStream fs = FileStream("C:\*****.jpg", FileMode.Open); 
DocumentEntry entry2 = service.Update(new Uri(strAlternateUriComesFromServer), fs, "text/plain", null) as DocumentEntry; 

此代码给出了错误。我如何编辑公共文档。

This code giving error. How can i edit public document.

我只有共享文档链接,我需要更新它。

i got only shared document link and i need to update it.

推荐答案

如果您知道文档名称或resourceID,并且该文档已与您共享,并且您具有正确的读/写访问权限(ACL),则更新资源应该没有任何问题。

If you know the document name or resourceID, and that document is shared with you, and you have the proper read/write access (ACL), you shouldn't have any problem updating the resource.

通常使用Google Documents API更新文档是这样的:

Normally updating a document with Google Documents API goes something like this:


  1. 获取文档的DocumentEntry。您可以构造DocumentQuery以根据某些搜索参数查找目标文档。请参阅此处的文档: Google Documents List API 3.0

从DocumentEntry对象获取下载URL,然后将文档下载到PC。如果您不希望修改原始内容,而只想上传和覆盖本地制作的内容,则可以选择下载。

Get the download URL from the DocumentEntry object and download the document to your PC. Downloading is optional if you're not interested in modifying the original content and just want to upload and overwrite the contents with something you have made locally.

编辑文档并将其更新(上传)到Google文档。 更新文档。具体来说,请查看 使用可恢复协议更新文档或文件内容。在现在将任何内容上传到文档时,您必须使用ResumableUploader。

Edit the document and update (upload) it to Google Docs. Documentation for Updating. Specifically, look at the section called "Updating document or file content with the resumable protocol." You must use the ResumableUploader when uploading anything to Docs now.

编辑添加:
尝试使用以下方法从公共链接获取DocumentEntry:

Edit to add: Try to get the DocumentEntry from the public link using the method below:

// Public Link contains the resourceID
// example:  https://docs.google.com/file/d/097iZigwrANhGTElvZDdCVmlZNzQ/edit
// resourceID:  097iZigwrANhGTElvZDdCVmlZNzQ
// Get Your Document Entry

string editUri = "http://docs.google.com/feeds/documents/private/full/%3A" + resourceID;
DocumentEntry docEntry = (DocumentEntry)service.Get(editUri); 

这篇关于Google文件。我需要使用公共链接C#编辑文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆