sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

OData functions are not working

Open ashokghoghari opened this issue 3 years ago • 9 comments

Hi, I am trying to use the OData function in power automation and getting below error.

Error: status":400, message:"The query is not valid.

Filter query. https://{MySP}.sharepoint.com/_api/web/lists/getbytitle('{MyListName}')/Items?$filter=day(Birthday) eq 20 and month(Birthday) eq 7

Please help me to figure it out.

[Enter feedback here]


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ashokghoghari avatar Jul 20 '22 10:07 ashokghoghari

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ghost avatar Jul 20 '22 10:07 ghost

@ashokghoghari please, remove $ before filter. It should work then.

AJIXuMuK avatar Jul 20 '22 18:07 AJIXuMuK

Removing $ before filter ignore my filter query.

ashokghoghari avatar Jul 21 '22 05:07 ashokghoghari

Is Birthday an actual property name on the objects returned in the Items collection? If Birthday is the name of a column in the list I'm not sure if we support a syntax to let you filter on a specific field easily.

JeremyKelley avatar Jul 21 '22 15:07 JeremyKelley

Related to #5481 which was closed due to no activity. There are more examples given in this issue of OData date functions not working as per the documentation.

The day(), month(), year(), hour(), minute(), second() functions are stated as supported in the docs, see
https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/use-odata-query-operations-in-sharepoint-rest-requests#odata-query-operators-supported-in-the-sharepoint-rest-service, but there are no examples given of how to use them correctly.

garrytrinder avatar Jan 19 '23 09:01 garrytrinder

@garrytrinder - Are we able to look into this? - I've never seen them used either, but have a use-case where they would be 🔥 - but judging from the threads here, the docs are simply outdate/wrong, would be awesome with a clarification 😊

Tanddant avatar Nov 23 '23 22:11 Tanddant

@Tanddant I would if I could :)

@AJIXuMuK is this something that you can look into?

garrytrinder avatar Dec 01 '23 16:12 garrytrinder