Minh Nguyen
Minh Nguyen

Reputation: 2039

Adding a new permission for google document content

I use google docs API(.net, c#) to share my document for other google user (ex: [email protected]). Here's my code:

        AclEntry entry = new AclEntry();
        entry.Scope = new AclScope();
        entry.Scope.Type = AclScope.SCOPE_USER;
        entry.Scope.Value = "[email protected]";

        entry.Role = new AclRole();
        entry.Role = AclRole.ACL_CALENDAR_READ;

        Service service = createService(szUserName, szPassword);
        string szAclUrl = ((DocumentEntry)contentEntry).AccessControlList;
        Uri AclUri = new Uri(szAclUrl);

        AtomEntry newAcl = service.Insert(AclUri, entry);

Note: service and contentEntry was created successfully.

But i get an error: (400) Bad Request when execute service.Insert(AclUri, entry) function.

What's i doing wrong? How can i add a new permission using google docs API(.net, c#)?

Upvotes: 0

Views: 472

Answers (1)

cuongVN
cuongVN

Reputation: 11

I think edit

 entry.Role = new AclRole();
    entry.Role = AclRole.ACL_CALENDAR_READ;

to :

entry.Role = new AclRole("reader"); or entry.Role = new AclRole("writer");

Upvotes: 1

Related Questions