I m trying to make a REST API call to SharePoint Online from a Java application where i want to get all the files in the Sharepoint site along with its custom metadata.

Now if i use the following query it gets me all the files based on the filter specified but it doesn't fetch all the items fields i.e. file metadata :

https://example.com/sites/sitename/_api/Web/GetFolderByServerRelativeUrl('/sites/foldername')/Files?$expand=Files&$filter=TimeLastModified gt datetime'2016-8-20T09:59:32'

Now if i use this query below it get me all the metadata of the files but the filter doesnt work and it returns all the files in the folder instead of the fetching the ones based on the filter=TimeLastModified.

https://example.com/sites/sitename/_api/Web/GetFolderByServerRelativeUrl('/sites/foldername')?$expand=Folders/ListItemAllFields,Files/ListItemAllFields&$filter=TimeLastModified gt datetime'2017-5-20T09:59:32'

Can someone please guide me how can i fetch the files based on the filter=TimeLastModified which also retrieves all "ListItemAllFields" so that it gets all the file's metadata as well at the same time ?

1 Answer 1


Try with this

https://example.com/sites/sitename/_api/Web/GetFolderByServerRelativeUrl('/sites/foldername')?$expand=ListItemAllFields&$filter=TimeLastModified gt datetime'2017-5-20T09:59:32'
  • Hi Marko, Thank you for your reply but this doesnt work either. This doesnt return any file information at all.
    – user67460
    May 29, 2017 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.