The following code always returns false (which is incorrect, as the user has Full Control permission at the site level):
Site site;
BasePermissions permissionMask;
ClientResult<bool> result;
permissionMask = new BasePermissions();
permissionMask.Set(PermissionKind.ManageWeb);
result = site.DoesUserHavePermissions(permissionMask);
return result.Value;
I am trying to utilize new SharePoint 2010 Client Object Model. I was thrilled when I discovered DoesUserHavePermissions method, but it appears that I’m not really sure if I know how to use it. I have no idea whether I am using the correct mask, or whether I should specify the user account for which I wish to check the permissions level? Any help would be greatly appreciated. Thanks.
One important thing was missing – the Client Context. This object is responsible for the actual execution of the query over any SharePoint Client Object Model objects.
The code should be modified to the following:
This will return true if the user is assigned ManageWeb permissions, or false if otherwise.
For a complete list of permissions enum, take a look at this MSDN page.