Wednesday, June 17, 2015

Get user information from Sharepoint User Profile in Sharepoint using C#

using (SPSite site = new SPSite("http://inhydcg056:9999))
{
ServerContext context = ServerContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(context);
UserProfile myProfile = profileManager.GetUserProfile("domian\username");
strDepartment = Convert.ToString(myProfile[PropertyConstants.Department].Value);
strJobTitle = Convert.ToString(myProfile[PropertyConstants.Title].Value);
}

No comments:

Post a Comment