cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

Send an HTTP Request to Sharepoint: Filter OR?

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'
I need the query to return records with ProjectNo 123, 141 or 154. 
Thank you!
2 ACCEPTED SOLUTIONS

Accepted Solutions
Dual Super User
Dual Super User

Re: Send an HTTP Request to Sharepoint: Filter OR?

@ericonline 

 

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

View solution in original post

Community Support Team
Community Support Team

Re: Send an HTTP Request to Sharepoint: Filter OR?

 

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,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Super User
Super User

Re: Send an HTTP Request to Sharepoint: Filter OR?

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'
Super User
Super User

Re: Send an HTTP Request to Sharepoint: Filter OR?

Error is "Bad Request"
 
"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"
Dual Super User
Dual Super User

Re: Send an HTTP Request to Sharepoint: Filter OR?

@ericonline 

 

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

View solution in original post

Community Support Team
Community Support Team

Re: Send an HTTP Request to Sharepoint: Filter OR?

 

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,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Super User
Super User

Re: Send an HTTP Request to Sharepoint: Filter OR?

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?

Super User
Super User

Re: Send an HTTP Request to Sharepoint: Filter OR?

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!)

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,677)