Hello,
I can't find the correct syntax to $filter on multiple values. Anyone come across how to do this yet?
Example:
https://mycompany.sharepoint.com/sites/test/_api/web/lists/GetByTitle('BigLis')/items?$filter=ProjectNo eq '123', '141', '154'
Solved! Go to Solution.
Try
?$filter=ProjectNo eq '123' or ProjectNo eq '141' or ProjectNo eq '154'
'--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Hi @ericonline ,
Please check this similar thread and see if it helps:
https://sharepoint.stackexchange.com/questions/163307/rest-api-filter-multiple-values
Best Regards,
I can get one to return with the following so I know the column is a String-type.
Its also a Lookup column, not sure if that matters...
https://mycompany.sharepoint.com/sites/test/_api/web/lists/GetByTitle('BigLis')/items?$filter=ProjectNo eq '123'
I've tried these variations to no avail...
filter=ProjectNo eq 15185 or 16236 or 16376 filter=ProjectNo eq '15185' or '16236' or '16376' filter=ProjectNo eq '15185' or eq '16236' or eq '16376' filter=ProjectNo eq '15185', '16236', '16376'
"status": 400, "message": "The query is not valid.\r\nclientRequestId: 30e70da3-c2c4-401a-8ab0-d7fb19129d79\r\nserviceRequestId: 1a550c9f-404e-9000-75b4-0f6e1eda22a7", "source": "https://mycompany.sharepoint.com/sites/_api/web/lists/GetByTitle('BigList')/items?$filter=ProjectNo%20eq%20'15185'%20or%20'16236'%20or%20'16376'", "errors": [ "-1", "Microsoft.SharePoint.SPException"
Try
?$filter=ProjectNo eq '123' or ProjectNo eq '141' or ProjectNo eq '154'
'--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Hi @ericonline ,
Please check this similar thread and see if it helps:
https://sharepoint.stackexchange.com/questions/163307/rest-api-filter-multiple-values
Best Regards,
Thank you @RezaDorrani and @v-bacao-msft for the solution. It worked.
Something I noticed is that there is a limit to the length of the Sharepoint HTTP URL. I have to limit the number of characters to about ~2050 otherwise the query fails.
Anyone else run into this?
And just another heads up... When you do exceed the ~2050 char limit in an HTTP Request, it fails with a Status 400 "Unauthorized" (which is not intuitive at all!)
User | Count |
---|---|
33 | |
15 | |
14 | |
13 | |
9 |
User | Count |
---|---|
39 | |
31 | |
26 | |
14 | |
12 |