Check specific user is Farm Administrator in Sharepoint

See there the function below, which is self descriptive, how to find specific user is Farm Admin.

Just copy and page the function and pass the account name, it will return the bool value accourdingly.

public static bool IsFarmAdmin(string loginName)
            bool isFarmAdmin = false;

                SPGroup adminGroup = SPAdministrationWebApplication.Local.Sites[0].AllWebs[0].SiteGroups[“Farm Administrators”];

                foreach (SPUser user in adminGroup.Users)
                    if (user.LoginName == loginName)
                        isFarmAdmin = true;


            return isFarmAdmin;



Leave a Reply

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