I have a list, call it Questions, that has a multi-lookup to another list, call it Answers. To get a single question by Id with its Answers, my query would look something like this...
$filter=Id eq 1&$expand=Answers&$select=Answers/Title
Now lets say I add an optional text column to the Answers list called Category. I would also like to include Category in my original query, so I update it to...
$filter=Id eq 1&$expand=Answers&$select=Answers/Title,Answers/Category
So far so good. Now to test my work...
- Associate one or many Answers that all have a Category with a Question. Passed.
- Associate one or many Answers that all do not have a Category with a Question. Failed.
- Associate one or many Answers with a Question. Some have a Category and some do not. Failed.
The REST query returns the following error:
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <m:code>-2146232832, Microsoft.SharePoint.SPException</m:code> <m:message xml:lang="en-US"> Cannot get value for projected field Questions_x005f_Category. </m:message> </m:error>
I have found no documentation that specifies that the selected property of the expanded entity cannot be null.
Is there a workaround? Can you explain what SharePoint is doing that would make this fail? Is is documented anywhere?
- Similar symptoms posted to a Microsoft forum with a vague explanation from a mod. https://social.msdn.microsoft.com/Forums/office/en-US/1667656c-0f44-41c7-a2e5-aa26e5937fb6/rest-api-sharepoint-2013-expand-does-not-work-when-user-assigned-to-has-multi-value?forum=sharepointcustomization