I need to get all the items in a specific folder in a list. I have tried few api like but it does not give me items in list. I need to get items so that I can get total length of folder.


What is missing in this api?


try this one https://server/_api/Web/GetFolderByServerRelativeUrl(<folder url>)?$expand=Files

  • Please explain along – Gaurravs May 23 '17 at 12:47

try this It will give all the folders and Files

  var folderUrl = '/documents/2015';
    var url = _spPageContextInfo.webServerRelativeUrl + "/_api/Web/GetFolderByServerRelativeUrl('" + folderUrl + "')?$expand=Folders,Files";

It will give all the files

var folderUrl = '/documents/2015';
var url = _spPageContextInfo.webServerRelativeUrl + "/_api/Web/GetFolderByServerRelativeUrl('" + folderUrl + "')?$expand=Files";

Check this Link:

Get all Files and Folders in one call

  • I have tried this already, but when i do data.d.results.length, this does not give me the total number of items in that folder – KumarV May 23 '17 at 15:30

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.