1

I would like to get items from list filter by ids through Microsoft Graph Api.

Something like items?$filter=fields/id eq '3' or '4' or '5'. I have to get many elements and I want limit requests.

Is there any way to do something like that?

2
  • Im having a hard time understanding your question about limit requests. Could you elaborate? Nov 19, 2019 at 14:43
  • I want to get a list of items based on the given id list. If the id list has 20 elements, I wanted to avoid calling the getById method 20 times only to do one query and download all elements at once.
    – Iwoo
    Nov 19, 2019 at 15:37

2 Answers 2

2

Just using

/_api/web/lists/GetByTitle('TestList')/items?$filter=Id eq '3' or Id eq '4' or Id eq '5'

enter image description here

0

As I understand it you would like to filter for multiple items using their ids? In that case you can do this by performing this query in this format:

items?$filter=fields/id eq '3' or fields/id eq '4' or fields/id eq '5'

However there seems to be an problem doing this with the graph api and SharePoint list items. So im not sure that this answers your question.

However there are multiple ways of doing this and the best way to learn is to have a look at the docs to see what query options you can perform. Use query parameters to customize responses and more specific $filter.

1
  • I wanted do the same way as you wrote in example ("items?$filter=fields/id eq '3' or fields/id eq '4' or fields/id eq '5"). But after this request in response preview i have: "error": { "code": "BadRequest", "message": "Invalid filter clause", "innerError": { "request-id": "bdedd6ba-3ba0-4c07-8f67-ad0b9d46ceff", "date": "2019-11-19T15:28:01" } }. I couldn't find anything similar in the documentation. That's why I ask because I was surprised by the lack of such functionality.
    – Iwoo
    Nov 19, 2019 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.