Wednesday, July 4, 2012

SharePoint | Show full name instead of username in user menu

Problem: In a SharePoint site, our name in the user menu control often appears as a username when we want it to show a pretty first name/last name string.

Solution: Since this data is being retrieved from the AD, we need to either create a complex control to get the First Name and Last Name fields form the user profile (http://bobbybeckner.com/index.php/sharepoint-get-user-profile-properties/) or edit the display name field for what we want (http://sharepointpolice.com/blog/2010/12/06/username-showing-up-as-domainnameusername-instead-of-full-name-in-sharepoint-2010/).

If you don't want to code anything and force profile service calls with admin permissions, you can just run a PowerShell command to set the display name, and synchronize it with the AD so that it persists.


PS C:\Users\tiago> Get-SPUser -web http://sharepointbind -Identity sharepointbin
d\tiago

UserLogin            DisplayName
---------            -----------
SHAREPOINTBIND\tiago SHAREPOINTBIND\tiago




PS C:\Users\tiago> set-spuser -web http://sharepointbind -identity sharepointbin
d\tiago -DisplayName 'Tiago Duarte'

PS C:\Users\tiago> Get-SPUser -web http://sharepointbind -Identity sharepointbin
d\tiago

UserLogin            DisplayName
---------            -----------
SHAREPOINTBIND\tiago Tiago Duarte


PS C:\Users\tiago>
Run this to sync the user details with AD
Set-SPUser -Identity 'sharepointbind\tiago' –Web http://SharePointServer –SyncFromAD .


Run this to synchronize all users with AD
Get-SPUser –Web http://SharePointServer | Set-SPUser –SyncFromAD

No comments:

Post a Comment