I have a SharePoint list on which Target Audience is enabled.

There is a custom list SPFx webpart which shows the list items using the Rest API.

I want to display the content based on the targeted audience in that webpart.

Example: When a user from Test 365 Group Members M365 group sees the above custom webpart, then only the targeted content must be displayed (like Item 1, Item 3, Item 5).

Is it possible to achieve the targeted content using Rest API? If yes, kindly help. If not, please suggest alternatives to achieve it in the SPFx webpart.

enter image description here

1 Answer 1


You can use Graph api to get the list items. It seems currently filter is not supported for list fields (Reference : https://learn.microsoft.com/en-us/answers/questions/980144/graph-api-sharepoint-list-filter-by-createddatetim).

So you can get all the items. It also returns target audience field. You can filter out the response data based on the group ID or Title.

GraphQuerySample - https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?expand=fields(select=Column1,Column2)

In above query replace site-id, list-id and column names with the actual value.

Refer below screenshot for sample response:

enter image description here

  • Still, it is not returning the list content as per the targeted audience. Mar 22, 2023 at 11:18
  • After fetching the M365 group, I need to check that whether the current user is part of that group or not. Is there a direct way means in a single call I can get the desired list item? Mar 22, 2023 at 11:25
  • You can use promis.all it accepts a list of promises instead of using separate calls. Mar 23, 2023 at 6:26

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.