How to publish Google Docs in .NET?

后端 未结 2 1706
孤独总比滥情好
孤独总比滥情好 2021-01-06 10:04

I\'m using the google-gdata .NET library for integrating with Google Docs. It\'s working out pretty well, but I can\'t figure out how to use it to publish my documents for v

相关标签:
2条回答
  • 2021-01-06 10:53

    I just updated the .NET client library, now you can use the following code to publish a revision (it assumes entry is the DocumentEntry instance you want to publish):

    RevisionQuery revisionQuery = new RevisionQuery(entry.RevisionDocument);
    RevisionFeed revisions = service.Query(revisionQuery);
    
    // TODO: choose the revision you want to publish, this sample selects the first one
    RevisionEntry revision = (RevisionEntry)revisions.Entries[0];
    
    revision.Publish = true;
    revision.PublishAuto = true;
    
    revision.Update();
    
    0 讨论(0)
  • 2021-01-06 10:54

    Your question has already been answered on this post which contains a Java code snippet. For .NET, you should be able to do something like that:

    AclEntry aclEntry = new AclEntry();
    aclEntry.Role = new AclRole("reader");
    aclEntry.Scope = new AclScope(AclScope.SCOPE_DEFAULT);
    
    // documentEntry is the document that you want to publish and service is an 
    // authorized DocumentsService object.
    AclEntry insertedEntry = service.Insert(
        new Uri(documentEntry.AccessControlList), aclEntry);
    
    0 讨论(0)
提交回复
热议问题