Get userprofile properties in SharePoint 2013 object model

using Microsoft.Office.Server.Social;

using Microsoft.Office.Server.Administration;
using Microsoft.Office.Server.UserProfiles;

using Microsoft.SharePoint.Portal.UserProfiles;

void GetUserProfileProperties()
{

SPWeb web = SPContext.Current.Web;

SPUser currentUser = SPContext.Current.Web.CurrentUser;

SPServiceContext serverContext = SPServiceContext.GetContext(web.Site);

UserProfileManager profileManager = new UserProfileManager(serverContext);

UserProfile profile = profileManager.GetUserProfile(currentUser.LoginName);

if (profile != null)
{
string displayName = profile.DisplayName;
}

}

Comments

Popular posts from this blog

what is Event Cache table in sharepoint

CAML Query syntax and options in SharePoint

Change anchor link url in sharepoint calender