Sunday, October 7, 2012

Elevated privileges in Sharepoint c#

You should create the SPWeb object within the Elevated privileges block, you shouldn't get the object from SPContext.
So, instead of this statement 'spWeb = SPContext.Current.Web' try to create a object
SPSite site = new SPSite();
SPWeb spWeb = site.OpenWeb();
and use this spWeb to call EnsureUser method.
Hope this should work.

No comments:

Post a Comment