Fix the ability to expand empty fields over REST for multi-lookups
Currently if any field on an item being looked up to as part of a multi-lookup is empty, the REST API throws an error and returns no items.
Expected or Desired Behavior:
Expanding a lookup field where multiple selections is enabled, and the expanded field on the lookup item is null, omits the field.
An HTTP 5000 error is returned.
For example, the error message is Cannot get value for projected field Assignedx005fEMail., where Assigned is a "Person or Group" column and EMail is the user's email address. This occurs if the user has no mailbox.
Steps to Reproduce
Create a list with a single additional column
Create a single item in the list, with the title field set and leaving the additional column blank
Create a list with a lookup column to the first list which allows multiple selections.
Create a single item in the list with the lookup field set.
Send a request to _api/web/lists/getByTitle('SecondList')/items?$select=Lookup/AdditionalField&$expand=Lookup
Create a list with a single user field which allows multiple selections
Create a single item. Add a user to the users column which does not have a mailbox
Send a request to _api/web/lists/getByTitle('List')/items?$select=Users/EMail&$expand=Users
Jake Stanger commented
This was previously an issue on GitHub https://github.com/SharePoint/sp-dev-docs/issues/4478 which was closed as I was told it had been a bug for so long it is now a feature.