SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to retrieve the display name('firstname lastname') of a user who logs in the SharePoint site.

When I log into my SharePoint site I could see at the top right --'domain/user name'. So when I try to retrieve the display name of the user using SharePoint object model (item adding event receiver)

SPWeb web = properties.OpenWeb();
var strCurrentUser = web.CurrentUser.Name; or var strCurrentUser = web.CurrentUser.LoginName;  

In both the cases strCurrentUser gives out 'domain/user' name.

Is there any way that i can get the full user name instead, like 'first-name last-name' or 'domain/first-name last-name'?

share|improve this question
up vote 4 down vote accepted

The SPUser object (SPContext.Current.Web.CurrentUser) does have a Name property, but it may not be filled out. If not, you may need to resort to going against the user profile ( ), but that is only available in Server (not Foundation).

share|improve this answer

You need to have user's first and last name in SharePoint User Profile Service Application in order to see 'firstname lastname'.

Try modifying User Profile of your test user: add first and last name. Then log out and back in and you should see the correct name.

If that works, update other users as well (by setting up user profile synchronization).

share|improve this answer

if you do not use user profile service, you can go to site actions -> site permissioms. There are users and groups that have access to your site. In this list you can click on a user name and see it's details. In ribbon on details view you can click on Edit button and set Name property of this user. after this you can retrieve it by SPUser.Name

share|improve this answer

UserProfile userProfile = GetUserInformation(user); string fullName= userProfile[PropertyConstants.AccountName].Value.ToString();

try this....

Hope this helps!

share|improve this answer

Check out this url, you can get first name last name in this way

share|improve this answer
While this may theoretically answer the question, we prefer inclusion of the essential parts of the answer here, and to provide the link for reference. See answer for general guidelines.Also we require disclosure of any affiliation with products or websites. Please see May I promote products or websites I am affiliated with here? for guidelines. – SPDoctor Aug 16 '12 at 19:09

I am having this problem all the time. Some users are showing up fine with full name (automatically filled from Active Directory), but others show only login name instead (domain\user). Still have not found the solution to this, neither the reason why it is happening.

However! I did find a very quick workaround to fix the name of certain users.

  1. Open SharePoint Management Shell (Start > type "Manage..." it will show up).

  2. Type and enter this line:

    Set-SPUser -Identity domain\user123 -DisplayName "James Cook" -Web http://SpServerHostName

  3. Done! All of a sudden, domain\user123 will show up as Jame Cook everywhere. As well as wherever you use SPUser.Name.

P.S. To update missing E-mail of user, add -Email "" part between -DisplayName and -Web.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.