using Microsoft.Office.Server;
using Microsoft.Office.Server.UserProfiles;
private string GetPreferredName(string accountName)
{
SPSite site = SPContext.Current.Web.Site;
ServerContext context = ServerContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(context);
try
{
UserProfile profile = profileManager.GetUserProfile(accountName);
return profile[PropertyConstants.PreferredName].ToString();
}
catch
{
return accountName;
}
}
Showing posts with label SharePoint - User Profile Information. Show all posts
Showing posts with label SharePoint - User Profile Information. Show all posts
Monday, May 30, 2011
How to get SharePoint user profile information from Account Name
Subscribe to:
Posts (Atom)