MSGraph request with $Filter returning Invalid Filter Clause - calendar

I am trying to use a filter on a MSGraph CalendarView request.
The request works perfectly until I add the filter to the URL. After adding the filter I receive the error:
"code":"BadRequest","message":"Invalid filter clause"
The URL I am using for the quest is:
https://graph.microsoft.com/v1.0/users/{userEmail}/calendar/calendarView?$filter=subject contains 'twilight'&$top=1000&startDateTime=2022-04-25T00:00:00-04:00&endDate=2022-04-30T00:00:00-04:00
I am trying to get any events with twilight in the subject between the date range.
Any ideas as I'm not sure what I'm missing.

The contains method should be used this way:
contains(subject, 'twilight')
Instead endDate there should be endDateTime
https://graph.microsoft.com/v1.0/users/{userEmail}/calendar/calendarView?
$filter=contains(subject,'twilight')&$top=1000
&startDateTime=2022-04-25T00:00:00-04:00&endDateTime=2022-04-30T00:00:00-04:00

Related

How to apply multiple filters to a query in url for gmail api

I am using HTTP requests via an Oracle database to extract data from Gmail APIs.
In Oracle, you apply all filters to either the URL of the request or its body.
This is working fine for simple requests such as the URL below to request list of unread messages in inbox for user:
https://gmail.googleapis.com/gmail/v1/users/me/messages?maxResults=500&q=is:unread&labelIds=INBOX
If I try to add more than one filter to the URL (or LabelIds) like in the URL below, I get an error response from the request:
https://gmail.googleapis.com/gmail/v1/users/me/messages?maxResults=500&q=is:unread newer_than:2d&labelIds=INBOX
I have tried multiple iterations for "q=" part like using double quotes, but anything I try outside of 1 filter returns an error response.
The documentation at https://developers.google.com/gmail/api/guides/filtering give this filtering example, but that clearly doesn't work for me:
https://www.googleapis.com/gmail/v1/users/me/messages?q=in:sent after:2014/01/01 before:2014/02/01
I tried removing the "is:unread" filter and adding it as a label, but I get a similar issue when trying to use multiple labelIds in the URL request. Using just labelIds=INBOX works fine, but using labelIds=INBOX,UNREAD or various iterations of that with quotes and square brackets all return error responses.
How do I use multiple filters (and/or multiple labelIds) in the URL of a request?
Thanks,
Dick
It looks like the problem is with the space between each filter in the q section.
If I add %20 for the space, it works.
For example, "https://gmail.googleapis.com/gmail/v1/users/me/messages?maxResults=500&q=is:unread newer_than:2d&labelIds=INBOX" will not work, but "https://gmail.googleapis.com/gmail/v1/users/me/messages?maxResults=500&q=is:unread%20newer_than:2d&labelIds=INBOX" will work.

"Also apply filter to matching conversations" gmail filter api

I have created gmail filter using API in c#.net. But when manually creating filter, I see there is an option called 'also apply filter to matching conversations', are we able to set this property while creating filter programatically? Or apply the filter to existing messages somehow? Basically the filter will set a label when received mail from particular user.
When you create a filter with the Gmail API, unfortunately you cannot apply it to already existing messages.
There is already feature request for this feature on Google Public Issue Tracker. You can give it a "star" to increase visibility.
In the meantime:
You can work around by
Listing messages - filtering them by specifying the query parameter q
Applying the desired filter action to the listing results, e.g. adding labels with batchModify

Get parameter from a given URL (not the calling) in Logic App

I have an URI as a string which I get out of a Json in my Logic App.
How can I access any of the query items of the uri?
Inside the For Each which loops through the uri string list, i tried the following expression to get the query parameter filename, but it did not work:
items('For_each_2')['queries']['filename']
This returns 'The template language expression 'items('For_each_2')['queries']['filename']' cannot be evaluated because property 'queries' cannot be selected'.
There is a URI parsing functions in logic app to query property from URI, suppose you want is uriQuery, however it returns the whole after ?. It will be like below.
And if you want to query a specific property, you should pass them with the logic app trigger URL. It provides triggerOutputs()['queries'] property to get the queries, and this will return a json object, it will allow you to query specific parameter.
This is a sample:
https://xyz.logic.azure.com:443/workflows/id/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=code&test=123&test2=345
Then should be able to use triggerOutputs()['queries']['test'] to query.

Ho to get last event using rest url from Elastic search particular index using timestamp inbuilt column?

From angular app i want call a rest service that returns latest event of a particular index and can anyone please provide me constructed url ?
In the event post long number of date as field and from angular app use [current date in long] and [current date in long-someseconds] and give the both value in the rest query against new field

How to get Task Due date of Custom object in email template?

I have a custom object and that has Task(s), I want to get the due date of the task to be included in the email (template) I plan to send out. Any ideas on how this can be achieved?
Something like this should do the work. Just replace "Custom_Object_Name" with the actual name and Task__r withe relationship name.
{!Custom_Object_Name__c.Task__r.ActivityDate}

Resources