Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 4.0 谷歌文档。我需要编辑带有公共链接c的文档#_C# 4.0_Google Docs Api - Fatal编程技术网

C# 4.0 谷歌文档。我需要编辑带有公共链接c的文档#

C# 4.0 谷歌文档。我需要编辑带有公共链接c的文档#,c#-4.0,google-docs-api,C# 4.0,Google Docs Api,谷歌文档。我需要用c#编辑一个带有puplic链接的文档。还有吗 FileStream fs = FileStream("C:\*****.jpg", FileMode.Open); DocumentEntry entry2 = service.Update(new Uri(strAlternateUriComesFromServer), fs, "text/plain", null) as DocumentEntry; 这段代码给出了一个错误。如何编辑公共文档 我只获得了共享文档链接,需

谷歌文档。我需要用c#编辑一个带有puplic链接的文档。还有吗

FileStream fs = FileStream("C:\*****.jpg", FileMode.Open); 
DocumentEntry entry2 = service.Update(new Uri(strAlternateUriComesFromServer), fs, "text/plain", null) as DocumentEntry; 
这段代码给出了一个错误。如何编辑公共文档


我只获得了共享文档链接,需要更新它。

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

通常,使用Google Documents API更新文档的过程如下:

  • 获取文档的文档条目。您可以根据某些搜索参数构造DocumentQuery来查找目标文档。请参阅此处的文档:

  • 从DocumentEntry对象获取下载URL,并将文档下载到您的电脑。如果您对修改原始内容不感兴趣,只想用本地制作的内容上载和覆盖内容,则下载是可选的

  • 编辑文档并将其更新(上传)到谷歌文档。具体地说,请查看名为“使用可恢复协议更新文档或文件内容。”的部分。您现在将任何内容上载到文档时,必须使用可恢复加载程序

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

    // 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); 
    

    这段代码非常有效。thanx寻求帮助。

    您必须向我们提供更多有关您所做的工作以及您面临的问题的详细信息。我希望这足够了:)我只有公共链接。我有读/写权限(ACL)。我没有文件和帐户信息。需要更新文档。我可以用internet explorer编辑它。在c#@Yusuf terzi中有什么方法可以看到我在上面的编辑。我无法在评论部分获得正确的格式。
        string editUri = "https://docs.google.com/feeds/default/private/full/file%3A" + resId;
    
        DocumentEntry docEntry = (DocumentEntry)dsServ1.Get(editUri);
        docEntry.Title.Text = strNewName;
        docEntry.MediaSource = new MediaFileSource("C:\\new.txt", "text/plain");
        ResumableUploader uploader = new ResumableUploader();
    
        // Start the update process.
        ClientLoginAuthenticator oa = new ClientLoginAuthenticator("Komote", ServiceNames.Documents, strUsername, strPassword);
        uploader.UpdateAsync(oa, docEntry, new object());