0

I'm using the Google Data .NET library. Given the URL of a folder (that the user might copy and paste from their browser for example) which includes the folder ID, I want to be able to get the access control list for that folder and make changes.

I can use FolderQuery like this:

        DocumentsService ss = new DocumentsService(appname);
        ss.setUserCredentials(username, password);

        FolderQuery fq = new FolderQuery(folderid);
        DocumentsFeed df = ss.Query(fq);

        DocumentEntry de = (DocumentEntry)df.Entries[0];
        Uri AclUri = new Uri(de.AccessControlList);

but that only returns the contents of the folder. I want the folder itself.

Any suggestions?

Thanks!

ron
  • 1,048
  • 7
  • 16

1 Answers1

0

The FolderQuery class is used to retrieve the content of the folder but you can retrieve the access control list of a folder as you would do it for a document.

The following snippet assumes folderId is the id of the folder you want to retrieve ACLs for:

DocumentsService ss = new DocumentsService(appname);
ss.setUserCredentials(username, password);

string uri = String.Format(DocumentsListQuery.aclsUriTemplate, folderId);
AclQuery query = new AclQuery(uri);
AclFeed feed = ss.Query(query);

foreach (AclEntry acl in feed.Entries)
{
    // Print the acl Role to the screen
    Console.WriteLine(acl.Role.Value);
    // Print the acl Scope type and value to the screen
    Console.WriteLine(acl.Scope.Type + " - " + acl.Scope.Value);
}
Claudio Cherubino
  • 14,896
  • 1
  • 35
  • 42