Check if a user is a SharePoint Administrator in JavaScript – SharePoint 2013.


Had a requirement to check if user is a SharePoint Admin or not and accordingly hide few elements in the page. We used the below code in our custom master page

Sample Code

var currentUser;

function IsUserAdmin() {
clientContext = SP.ClientContext.get_current();
spWeb = clientContext.get_web();
currentUser = spWeb.get_currentUser();
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

function onQuerySucceeded(sender, args) {

var isUserAdmin = currentUser.get_isSiteAdmin();
if (isUserAdmin) {

alert('Current User is Administrator');

} else {

alert('Current User is not an Administrator');

function onQueryFailed(sender, args) {

alert('Request failed. ' + args.get_message() +
'\n' + args.get_stackTrace());

ExecuteOrDelayUntilScriptLoaded(GetCount, "sp.js");

Hope it helps ..

Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

2 thoughts on “Check if a user is a SharePoint Administrator in JavaScript – SharePoint 2013.”

  1. Wonderful beat ! I would like to apprentice at the same time as you amend your web site, how can i subscribe for a weblog website? The account helped me a acceptable deal. I were a little bit acquainted of this your broadcast provided brilliant transparent concept


Please share your thoughts

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.