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
Highlighted
Dual Super User II
Dual Super User II

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

Highlighted
Community Support
Community Support

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
Highlighted
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'
Highlighted
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"
Highlighted
Dual Super User II
Dual Super User II

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

Highlighted
Community Support
Community Support

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

Highlighted
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?

Highlighted
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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Users online (6,832)