I'm trying to build a query to retrieve list items using the REST API. Is there a way to expand on certain fields, but still bring back every other field? This is for use within a SharePoint-hosted add-in.
appWebUrl + "/_api/SP.AppContextSite(@target)/web/lists/getbytitle(@name)/items?" + "@target='" + webUrl + "'&@name='" + listName + "'" + "&$select=ID,Title,Request_x0020_Status,mpsRequestStatus,Request_x0020_Estimated_x0020_Ho,RoutingPriority,Priority,Request_x0020_Description,Request_x0020_Response_x0020_Des,Assigned_x0020_To/Title&$expand=Assigned_x0020_To/Id"
The problem is that there are some lists that have some of the fields specified in the query while others do not. Originally, I didn't have any
expands, so that the data retrieved was whatever that's available, which worked great. I needed to expand the
AssignedTo field in order to get the user's name and if I left out the other fields, then the call would just bring back that field's data only. Is there a way to expand on
AssignedTo (or another field), but not limit it to that only? Thanks in advance.