32

I have a list with a people column called AssignedTo. I'm making a rest call:

.../_api/web/Lists/GetByTitle('listname')/Items?$expand=AssignedTo&$select=*,AssignedTo/Title

Which is successfully returning the name of the person the item was assigned to. I'm trying to get other user information like email or their user id.

Most tutorials online show how to expand ID and Title (Name) and from this blog I found a list of these properties that can be expanded:

  • ID
  • FirstName
  • LastName
  • Title
  • Department
  • SipAddress

And those all work. But I can't find the email and or the login ID. I've tried $select=AssignedTo/LoginName and several other variations on that, but they all return that the field is not valid. I was hoping $select=AssignedTo/* would expand all the fields, but that doesn't rework either.

Anyone know if the above are the only fields that can be expanded off a people column?

3 Answers 3

55

Try AssignedTo/EMail....case sensitive.

Available values from a user field (Source):

Title

Name

EMail

MobilePhone

SipAddress

Department

JobTitle

FirstName

LastName

WorkPhone

UserName

Office

ID

Modified

Created

ImnName

NameWithPicture

NameWithPictureAndDetails

ContentTypeDisp

2
  • Can you also suggest a source for this information? Commented Feb 17, 2016 at 14:53
  • Added the source. Couldnt find an MSDN article on it unfortunately.
    – Dana K
    Commented Feb 17, 2016 at 15:27
7

On SharePoint Online, to get the login name (account name) from a user field in a list, you need to select the Name property:

.../_api/web/lists/getbytitle('ListName')/items(60)?$select=MyUserField/Name&$expand=MyUserField

This returns the account name in the format i:0#.f|membership|[email protected]. You'll need this value if you want to query the user profile service for more info on the user.

2
  • does the same applies for SP 2016? or should we query for a different property Commented Aug 24, 2017 at 9:29
  • 2
    Just checked on an SP2016 build, and it's exactly the same - expand [NameOfUserField] and select [NameOfUserField]/Name.
    – Jason Lee
    Commented Aug 25, 2017 at 11:04
2

I believe by using the person type field you are limited to the fields mentioned in the blog you linked. You can however make a rest call to get a person's UserProfile properties.

Vardhaman has a great post on what properties you can access and how to do it.

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.