I have a user set up as a site collection admin at the root level of my sharepoint site, and all subsites inherit these permissions. I have also verified that my user admin1
has FULL CONTROL rights to the entire site...so why do
both IsUserAdmin
and ManageWeb
permissions return false
??
If I run this code against my global tenant admin user, both values return true
. What gives? I do not believe the App-only policy applies here.
using (
var ctx = TokenHelper.GetClientContextWithAccessToken(
webUrl, sharePointAuthResult.AccessToken))
{
var spWeb = ctx.Web;
var user = ctx.Web.EnsureUser(accessInfo.UserEmail);
ctx.Load(spWeb, w => w.EffectiveBasePermissions);
ctx.Load(user);
ctx.ExecuteQuery();
var managePermission = new Permission(
"Manage",
ctx.Web.EffectiveBasePermissions.Has(PermissionKind.ManageWeb));
var isAdmin = user.IsSiteAdmin;
/*
managePermission.IsGranted == false (why?)
isAdmin == false (why?)
*/
}
In case it's useful, I am developing an Office 365 snap-in app for Word, so I am using the OAuth2 Authorization Code Grant Flow to allow the user to grant consent to the app for read / write permissions.