ExpertConnect - Mentoring & Discussions

You can join mentoring & discussions for Free Ask Question, Give Answer, Discuss IT Problems, Learn, and Grow

2017-10-20 14:12:46 3

Sharepoint 2013

Topic menu

2018-04-20 17:39:10 1
Profile picture of Michel  Loy
Michel  Loy
Public
Posted: Apr 20, 2018

Why do we use RunWithElevatedPrivileges() method in SharePoint ?

Comment (1) ·  Like (3)
Profile picture of Hammad Shahid

Hammad Shahid Apr 20, 2018

Sometimes in custom SharePoint solution you need to execute custom code using System Account privileges than the current logged in user which may not have sufficient rights to execute custom code. In these situations we use RunWithElevatedPrivileges() method to delegate System Account rights to current logged in user.
When you put your code inside RunWithElevatedPrivileges() code block it runs using the App Pool account, so you must ensure that the App Pool account is a member of a site collection group with sufficient perms to to add/edit/delete or whatever your code is trying to do.
If not, the code will quietly break without popping an exception.

Like

Write a new comment...
Ready to post? select an option: