(using sp online, csom)

I want to get users LoginName the cheapest possible way (ie, avoid executequery). The user is stored in a field of type User. According to this example, the users loginname should be in res.LookupValue (below), but I get users displayname.

var userValue = (FieldUserValue)pListItem[pColumn];
string thisWillBeUsersDisplayName = userValue.LookupValue;

What am I doing wrong?

4 Answers 4


The FieldUserValue.LookupValue depends on how the field is configured in the list. It may return the display name, email address, login name. This can be updated at any time by someone with design permissions on the list.

You can use the FieldUserValue.Email property to call the Utility.ResolvePrincipal method to get the LoginName. See https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-user-identity-and-properties-in-sharepoint#retrieve-current-website-user-identity-by-using-the-web-object for details.



var userValue = (FieldUserValue)pListItem[pColumn];
var user = clientContext.Web.GetUserById(userValue.LookupId);
clientContext.Load(user, x => x.LoginName);
string thisWillBeUsersLoginName = user.LoginName;

In CSOM FieldUserValue.LookupValue returns user's display name. Alternatively you can query user details from 'Users Info List' by passing user id but you have to do it with ClientContext.ExecuteQuery() which you want to avoid.

In case, If you want to use REST API then you can use below,


Above endpoint url return 'Name' which is similar to Login Name in sharePoint online. REST is also easy & faster way to retrieve data.


The FieldUserValue Class will return only the display name.

Try SPFieldUserValue

var userLookup = (SPFieldUserValue)useritems[0]["Author"];

var loginName = userLookup.LoginName;


  • 2
    Im using CSOM (for sharepoint online), SPFieldUserValue is server object model. Its not possible to use here
    – Cowborg
    Jul 25, 2017 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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