question

AluriSrinivasarao-2861 avatar image
0 Votes"
AluriSrinivasarao-2861 asked DobbySpencer-8651 commented

Sharepoint API Date Filter

Hi ,

I tried to get the meeting details in sharpoint using RestAPI with filter as Meeting ID, then the Meeting is coming.But when tried to filter with date I'm getting this error response


{
"error": {
"code": "-1, Microsoft.SharePoint.Client.InvalidClientQueryException",
"message": {
"lang": "en-US",
"value": "The expression \"startdatetime ge datetime '2020-10-01T00:00:00Z' and enddatetime ge datetime '2020-10-15T00:00:00Z'\" is not valid."
}
}
}

office-sharepoint-onlineoffice-sharepoint-server-administrationoffice-sharepoint-server-development
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@AluriSrinivasarao-2861,

Is there any update ? Have you tried the endpoint in the answer ?

0 Votes 0 ·

Hi,

I'm trying to use the Graph Explorer to get items from a Sharepoint calendar and filter with date greater than a specific date. I get "Invalid filter clause" error when I add the filter.

I access my shared calendar from the URL below:
https://*.sharepoint.com/sites/IT/Lists/ITpto/calendar.aspx

In Graph Explorer I use the URL below:
https://graph.microsoft.com/v1.0/sites/*.sharepoint.com:/sites/IT:/lists/ITpto/items?$filter=EventDate ge datetime'2020-10-01T00:00:00Z'

The ultimate goal is to retrieve the description of the event, start date, end date, and who created the event from the shared calendar.

There is another requirement to create events in the shared calendar from our HR system for approved PTO.

0 Votes 0 ·

1 Answer

Jerryzy avatar image
0 Votes"
Jerryzy answered

Hi @AluriSrinivasarao-2861 ,

If it's SharePoint Calendar List, then try to filter based on Start/EndDate range like this:

/_api/web/lists/getbyTitle('Cal')/items?$filter=EventDate ge datetime'2020-10-01T00:00:00Z' and EndDate le datetime'2020-10-15T00:00:00Z'

Reference:

Filtering Items by Date Range using SharePoint 2013 REST API




If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.