home screen

Search



Number Of Result : 0

Result :


Friday, April 9, 2010

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

- Error code:

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))


- Use this delegate to executes the specified method with Full Control rights even if the user does not otherwise have Full Control

SPSecurity.RunWithElevatedPrivileges(delegate()
{
//Update Fields here.
});



SPSecurity.RunWithElevatedPrivileges(delegate()
{

using (SPSite site = new SPSite(new Guid("b3fcdea6-ddbb-4d12-bf89-5ec5e0adc6d8")))
{
site.WebApplication.FormDigestSettings.Enabled = false;
using (SPWeb web = site.OpenWeb())
{
web.AllowUnsafeUpdates = true;
web.Title = "new";
web.Update();
web.AllowUnsafeUpdates = true;
}
site.WebApplication.FormDigestSettings.Enabled = true;
}

});

No comments: