I am trying to find a way to combine two rest calls so that it gives me the correct files as well as the relevant data.

This call gives me the correct data


This call gives me the correct files


Is there a way to combine these two so that I get the correct files as well as the correct data for those files?


You can combine these two by $expanding ListItemAllFields column of the File. ListItemAllFields is __deferred property of File. I believe you know that we need to $expand all Lookup columns and __deferred properties to get information. Anyway, from ListItemAllFields you can get all information what you get from /_api/Lists/GetByTitle('Pages')/Items?$select=ID,Title,FileRef,Modules.

Combined End-Point is

var baseUrl = "/_api/Web/GetFolderByServerRelativeUrl('Pages/Landing Pages')/Files?";

var selectQuery = "$select=ListItemAllFields/ID,ListItemAllFields/Title,ListItemAllFields/FileRef,ListItemAllFields/Modules&";

var expandQuery = "$expand=ListItemAllFields";

var combinedUrl = baseUrl + selectQuery + expandQuery;

For testing and exploring REST API, you can use my SharePoint REST Client.

enter image description here

Find more about $expand in my article CRUD Operation to List Using SharePoint 2013 Rest API

|improve this answer|||||

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.