Pages

Subscribe:

Thursday, December 1, 2011

Create a User Profile Using the Object Model


public void CreateUserProfile()
{
//We have to get the Context of the service application
strUrl = "http://site";
SPSite spSite = new SPSite(strUrl);
        ServerContext siteContext = ServerContext.GetContext(spSite);
        
       //UserProfileManager class contains member for profiles
       UserProfileManager upManager = new UserProfileManager(siteContext);       
       string strUserName = "domain\\user";
       if (!upManager.UserExists(strUserName ))
       upManager.CreateUserProfile(strUserName);
}

No comments:

Post a Comment