2

I am using Microsoft Graph API and trying to filter items in a SharePoint List by CreatedBy User but am not sure how to write the filter query.

https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?$$filter=

I have tried "https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?&$filter=AuthorLookupId eq {user-id}" but it doesn't seem to work.

2
  • I'm afraid it's impossible. When a graph api support Ddata query, it will have a setion named Optional query parameters in the api document, but this api doesn't have this section. Commented Dec 25, 2022 at 9:21
  • why would you use Microsoft Graph API while you can call SharePoint REST API directly Commented Dec 25, 2022 at 15:01

2 Answers 2

0

According to my research and testing, unfortunately, there is currently no Graph API can filter items by CreatedBy User. As a workaround, I recommend you use the following REST API to filter items:

https://xxxxx.sharepoint.com/sites/xxx/_api/web/lists/getbytitle('xxxx')/items?$filter=AuthorId eq 21

Thanks for your understanding.

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

1 Comment

It should be /items?$expand=fields&$filter=fields/AuthorId eq 21 because AuthorId is a field
0

You can at least filter items by field AuthorLookupId. The filtering can be allowed by adding the header Prefer: HonorNonIndexedQueriesWarningMayFailRandomly.

GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?$expand=fields&filter=fields/AuthorLookupId eq '10'

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

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.