If you change the identity of the application pool, and the new account is not the System account, what account is used when calling SPSecurity.RunWithElevatedPrivileges?


SPSecurity.RunWithElevatedPrivileges reverts to the identity of the application pool (among other things). So, the code runs under the new identity you specified.
Also, if you did change the app pool's identity property (i.e. from the Central Administration Tool, so SharePoint sets correct permissions on the content DB + propagate changes to all servers in the farm) it is now the "new" System Account.

| improve this answer | |

SPSecurity.RunWithElevatedPrivileges always executes the code under Application Pool Identity. So you must ensure that Application Pool Identity has proper permissions over site, otherwise you will get access denied error.

| improve this answer | |
  • which permissions we need to give for the Application Pool Identity – ranjith Feb 16 '16 at 9:19
  • Its depending upon your requirements. If you want to add, update, and delete list items and documents then App Pool Identity should have at least "Contribute" access . If you want to Add, edit, and delete lists then "Edit" access. If you are dealing with some critical tasks then you can give "Full Control". – SP Developer Feb 16 '16 at 11:54

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.