1

I am trying to get a list of old files from our SharePoint online site via REST API but keep getting error:

"The expression is not valid"

I tried the following links with same error:

https://mytenant.sharepoint.com/sites/mysite/_api/web/lists/GetByTitle('Documents')/items$filter=Created le datetime'2017-12-06T18:30:00Z'
https://mytenant.sharepoint.com/sites/mysite/_api/web/lists/GetByTitle('Documents')/items$filter=Created le '@{addDays(convertFromUtc(utcNow(),'AUS Eastern Standard Time'),2,'yyyy-MM-dd')}'
https://mytenant.sharepoint.com/sites/mysite/_api/web/lists/GetByTitle('Documents')/items$filter=Created le '2017-12-06'

Any idea how to get it working?

1 Answer 1

2

I think you forgot to add question mark ( ? ) after /items in the SharePoint REST API endpoint.

This should work for you:

https://mytenant.sharepoint.com/sites/mysite/_api/web/lists/GetByTitle('Documents')/items?$filter=Created le datetime'2017-12-06T18:30:00Z'

Reference: Filter Created in SP REST API

2
  • 1
    Shame on me :( Thanks Ganesh :) Commented May 22 at 8:55
  • No worries, it happens sometimes. Glad you got it working now. Commented May 22 at 9:02

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.