I tried to retrieve emails only with particular subject and received date. I used the following query and got an error:
“subject:”+in_Keywords +" AND received: >="+Convert.ToDateTime(Date.Now.AddDays(-1).ToString(“MM/dd/yyyy 21:00”)).ToString
What is the correct way to write a query in UiPath.MocrosoftOffice365.Activities.Mail.Getmail activity?
I have modified my query to :
“subject eq '” + in_Keywords + “'” + " and receivedDateTime ge ‘" + Convert.ToDateTime(Date.Now.AddDays(-1).ToString(“yyyy-MM-dd 21:00”)).ToString + "’"
But got the following error:
Get Mail: Code: BadRequest
Message: Invalid filter clause: A binary operator with incompatible types was detected. Found operand types ‘Edm.DateTimeOffset’ and ‘Edm.String’ for operator kind ‘GreaterThanOrEqual’.
Inner error:
AdditionalData:
date: 2024-02-06T22:49:40
request-id: 7b2c9c98-9aeb-4bc2-b6b8-4b7fe762344e
client-request-id: 7b2c9c98-9aeb-4bc2-b6b8-4b7fe762344e
ClientRequestId: 7b2c9c98-9aeb-4bc2-b6b8-4b7fe762344e
we can avoid a few unneeded redundant conversions
Now - is already a datetime we dont need to convert it to a string - parsing the string into a datetime and convert it into a string again