12

Traditionally I use:

if (web.CurrentUser.Name == "System Account")

Is there a possibility the System Account Name could be something other then "System Account". Is there a more reliable way to check if CurrentUser is the System Account?

This is using SharePoint 2010.

11

To check if the Current User is system account you can use

if (web.CurrentUser.ID == web.Site.SystemAccount.ID) 

SystemAccount is a property of SPSite object which gets the System Account of the site collection

8
SPContext.Current.Web.CurrentUser.ID == SPContext.Current.Site.SystemAccount.ID

This method is suitable?

  • 1
    Yes except SPContext is null for me this in this case so I had to go with the SPWeb object from the event properties to grab the CurrenUser – Meyer Denney Aug 9 '12 at 5:37
-5

Yes actually you can.

  • Go to central administration

    1. Click on Security on the left
    2. Click on "Specify web application user policy"
    3. Click on the account you want to check on
    4. Check or uncheck the "Choose System Settings" option with "Account Operates as System"
  • 2
    -1 Unfortunately you appear to be answering the wrong question – Stu Pegg Aug 9 '12 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.