Quantcast
Channel: Microsoft Online: SharePoint Online forum
Viewing all articles
Browse latest Browse all 10096

Q: Retrieving IsSiteAdmin for a User from a Provider Hosted App?

$
0
0

I'm currently using the Client Object Model from a Provider Hosted App to retrieve the value of IsAdmin but, frustratingly, its constantly returning false. Any tips on how to achieve this? Currently using the following method

        public static Role CheckPrivileges(HttpContextBase httpContext)        {            var spContext = SharePointContextProvider.Current.GetSharePointContext(httpContext);            using (var clientContext = spContext.CreateUserClientContextForSPHost())            {                var currentUser = clientContext.Web.CurrentUser;                clientContext.Load(currentUser, u => u.IsSiteAdmin);                clientContext.ExecuteQuery();                if (currentUser.IsSiteAdmin)                    return Role.SiteAdmin;                else                    return Role.User;            }                    }

Thanks in advance!

Sincerely,
//Adam


Viewing all articles
Browse latest Browse all 10096

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>