Friday 13 December 2013

SPSecurity.RunWithElevatedPrivileges Method

RunWithElevatedPrivileges Method:



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

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.


SPSecurity.RunWithElevatedPrivileges(delegate()
{
    using (SPSite site = new SPSite(web.Site.ID))
    {
    // implementation details omitted
    }
});

No comments:

Post a Comment