Get UserProfile programmatically using SharePoint Server Object Model?
using (SPSite site = new SPSite("Your site url here"))
{
SPServiceContext context = SPServiceContext.GetContext(site);
UserProfileManager upm = new UserProfileManager(context);
UserProfile profile =
upm.GetUserProfile("your user name here");
String WorkEmail = profile[PropertyConstants.WorkEmail].Value.ToString();
String FirstName = profile[PropertyConstants.FirstName].Value.ToString();
String
LastName = profile[PropertyConstants.LastName].Value.ToString();
}
Comments
Post a Comment