3

SPSecurity.RunWithElevatedPrivileges Method Executes the specified method with Full Control rights even if the user does not otherwise have Full Control.

1) But which under which account does this code run?

I read that it runs under the SYSTEM ACCOUNT.

a.   what is this system account refers to?

Is it the account used to create the web application or is it the account used to create the site collection. Or is it the SHAREPOINT\SYSTEM (what is this account, from where did it come?) what?

2) It is said that the code inside this runs under Full Control rights. But then, don't we have to add this particular user (say SYSTEM ACCOUNT?) into any of the groups (member) on our site so that he get the full control?

2 Answers 2

3

Please check MSDN: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges(v=office.14).aspx

Executes the specified method with Full Control rights even if the user does not otherwise have Full Control.

Parameters secureCode Type: Microsoft.SharePoint.SPSecurity.CodeToRunElevated A delegate method that is to run with elevated rights. This method runs under the Application Pool identity, which has site collection administrator privileges on all site collections hosted by that application pool.

7
  • So does it also become the system adminsitrator level priviledge?
    – variable
    Mar 21, 2014 at 9:18
  • What do you mean with System Administrator? Or maybe better: change your question to explain what code do you want to run with Elevated Privileges, so we can understand if it will work with sufficient privileges or not
    – tweytjens
    Mar 21, 2014 at 9:24
  • Sorry but there is no requirement, just curious to know.. system adminsitrator I meant the Site collection admin (sorry for mistake)
    – variable
    Mar 21, 2014 at 9:28
  • Yes, it will run as the Application Pool Identity, which will be Site Collection Administrator for every site collection hosted in its Application Pool
    – tweytjens
    Mar 21, 2014 at 9:33
  • please check my updated question
    – variable
    Apr 10, 2014 at 7:54
1

It runs under the permissions of the System Account of the WebApplication. The System account is the account with which the App Pool of the Web Application is configured.

4
  • So does it also become the system adminsitrator level priviledge?
    – variable
    Mar 21, 2014 at 8:49
  • Sorry site collection admin (mistake)
    – variable
    Mar 21, 2014 at 9:29
  • Yes, the app pool identity has site collection admin rights on all site collections hosted under it. It says so in the linked MSDN article from the other answer ;). Mar 21, 2014 at 9:55
  • Hi Vardhaman, System acc. is SHAREPOINT\SYSTEM, but app pool account is the one used when creating the web app: DOMAIN\USERNAME. So for this article: nothingbutsharepoint.com/sites/devwiki/articles/Pages/… Can you tell me whther I should give permission in AD for SHAREPOINT\SYSTEM or to the DOMAIN\USERNAME ?
    – variable
    Jul 24, 2014 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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