Skip to content

Instantly share code, notes, and snippets.

@caleb-vear
Created August 28, 2011 09:41
Show Gist options
  • Save caleb-vear/1176479 to your computer and use it in GitHub Desktop.
Save caleb-vear/1176479 to your computer and use it in GitHub Desktop.
Example of SPSecurity.RunWithElevatedPrivileges
public void YourMethod()
{
SPSecurity.RunWithElevatedPrivileges(() =>
{
using (var site = new SPSite(Request.Url.ToString()))
{
// Your work goes here...
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment