using (SPSite site = new SPSite(siteURL))
{
using (SPSite siteAsOtherUser = new SPSite(siteURL, site.RootWeb.AllUsers["WS2003\\Administrator"].UserToken))
{
SPWeb web = siteAsOtherUser.OpenWeb();
//Write code with elevated privilege.
}
}
Tuesday, April 5, 2011
Impersonating using SPUserToken object
Labels:
elevated privilege,
impersonation,
SPUserToken
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment