microsoft-graph-apizoho-deluge

Filters in Microsoft GraphAPI not wroking as expected and giving strange results


The Query below applies filter that timeOff entries'
sharedTimeOff/startDateTime >= formattedTodayDateTime and
sharedTimeOff/endDateTime <= formattedRequiredEndDateTime

which translates to formattedTodayDateTime <= timeOff's start_date and end_date <= formattedRequiredEndDateTime.

This query gives number of entries in response (non empty) .

// headers and accessTokens approprately formed
params = Map();
params.put("$filter","sharedTimeOff/startDateTime ge " + formattedTodayDateTime + " and sharedTimeOff/endDateTime le " + formattedRequiredEndDateTime + "");
response = invokeurl
[
    url :graphUrl
    type :GET
    parameters:params
    headers:headers
];

In below query, I am filtering for timeoff entries such that,

formattedTodayDateTime <= timeOff's end_date <= formattedRequiredEndDateTime.

params = Map();
params.put("$filter","sharedTimeOff/endDateTime ge " + formattedTodayDateTime + " and sharedTimeOff/endDateTime le " + formattedRequiredEndDateTime + "");
response = invokeurl
[
    url :graphUrl
    type :GET
    parameters:params
    headers:headers
];

Issue: Second query should give me more number of responses, but it gives me absolutely empty response.

I am expecting more entries in my response. But keep getting empty response.
I have tried changing query to formattedTodayDateTime <= timeOff's end_date <= formattedRequiredEndDateTime, this also gives me empty response.


Solution

  • It's mentioned in the doc that $filter parameter doesn't support the use of the same property more than once in a query.

    In the second query, you are specifying sharedTimeOff/endDateTime twice.