Welcome to Comunidade Bloggers |create|it| Sign in | Join | Help

Raúl Ribeiro

Windows SharePoint Services 3.0 , .net, Microsoft Office SharePoint 2007, Office 2007 and 2010

News

Using SPUserToken

When you need to do something in a list or item, in SharePoint, with a specific user you can use the SPUserToken.

Here is an example:

try{
    SPWeb webOrigUser = SPContext.Current.Web;

    //get the token for the impersonation user
    SPUserToken token = webOrigUser.AllUsers[USERNAME].UserToken;

    SPSite site = new SPSite(SiteId/SiteUrl, token);
    .....
}catch{}

Posted: Tuesday, November 04, 2008 11:15 AM by admin
Filed under:

Comments

No Comments

Anonymous comments are disabled