5

I can get all items in a list with: https://graph.microsoft.com/v1.0/sites/{SiteID}/lists/{ListID}/items

I can get a specific item in a list with: https://graph.microsoft.com/v1.0/sites/{SiteID}/lists/{ListID}/items/{ItemID}

But I have to KNOW the ItemID to interact with that specific item.

Is there no way to use $search or $filter on list items to find an item by one of my actual column values, like $filter=Title eq 'whatever', to then be able to pull the ItemID for that item so I can update values for it?

Or do I just have to download the entire list and filter it myself? Seems inefficient though if it were to be a large list.

Thank you!

1
  • 1
    AFAIK, the columns that are created for lists are not indexed, so they are not searchable or filterable. You can simply get the items with fields(Columns) using this http call https://graph.microsoft.com/v1.0/sites/{siteid}/lists/{listid}/items?$expand=fields and then filter it on your end by writing code. Commented Apr 10, 2021 at 4:06

1 Answer 1

9

The filtering can be allowed by adding the header Prefer: HonorNonIndexedQueriesWarningMayFailRandomly.

GET https://graph.microsoft.com/v1.0/sites/{siteId}/lists/{listId}/items?$expand=fields&filter=fields/Title eq 'whatever'

One disadvantage is that such queries can fail on large lists

Sign up to request clarification or add additional context in comments.

2 Comments

Ta - this works perfectly and the problem has been bugging me for years!
Rhetorical question, but how can anyone confidently implement anything that includes ‘may fail randomly’ in its name?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.