26

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?

36

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

  • Can you also suggest a source for this information? – Nisarg Feb 17 '16 at 14:53
  • Added the source. Couldnt find an MSDN article on it unfortunately. – Dana K Feb 17 '16 at 15:27
3

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|user@domain.com. You'll need this value if you want to query the user profile service for more info on the user.

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

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, privacy policy and cookie policy

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