'SharePoint Rest API with Power Automate Flow to compare Created date with utcNow()
I'm trying to create a query using the SharePoint Rest API in a Power Automate flow. I would like to return only the records where the Created date is equal to the current date. The date value for the Created field is automagically created when the record is created. This flow runs once a day so it should look for only list items that were created today.
I believe I have set everything up correctly:
_api/Web/Lists/GetByTitle('DALs Details')/Items?
$select=Owner2,Modified,Created&$filter=Created eq utcNow()&$top=10
I get the following error:
The expression "Created eq 2022-05-19T01:39:32.2957783Z" is not valid.
clientRequestId: bef4b8f5-e632-486b-8066-08815203f3a4
serviceRequestId: 52c23ea0-90df-0000-12c2-1f7ec0ea4fbe
I've google everything from SharePoint REST API to power automate using SharePoint REST API. There a lot of examples but none of them seem to work. I get the same error, as mentioned below.
An additional detail, when I view the Created field in the SharePoint list the values are "April 13", "May 5", "7 hours ago", and "Yesterday at 9:45 PM". If I take remove the filter from the query string, I get a full date and value in the results for Created. I'm guessing I will have to do some formatting of that in my request so that it matches the results returned by the utcNow() function. Again, I just need to compare the day the flow runs with the day that the record/item was created.
When I remove the filter property:
_api/Web/Lists/GetByTitle('DALs Details')/Items?
$select=Owner2,Modified,Created&$top=10
I get the following results for Created and Modified:
"Modified": "2022-05-18T18:37:17Z",
"Created": "2022-04-13T22:46:33Z",
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
