SPSite spsSite = new SPSite(_serverNameURL); // Get the instance of site collection.
ServerContext serverContext = ServerContext.GetContext(spsSite); //Get the instance of server context
UserProfileManager profileManager = new UserProfileManager(serverContext); //Create an instance to sharepoint user profile
if (profileManager.UserExists(userName)) // Check whether user "userName" exists in sharepoint user profiles.
{
UserProfile userProfile = profileManager.GetUserProfile(userName); // Get the instance of users userprofile.
string strEMAIL=userProfile["WorkEmail"].Value; //Example of accessing EMail profile property.
}
Tuesday, October 7, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment