Please provide a code example showing how to fetch all the Azure AD Groups using Microsoft Graph API so that the user can search for a particular Azure AD Group

Vivek Gupta 126 Reputation points
2020-08-17T03:04:19.83+00:00

Hi,

Please provide a code example showing how to fetch all the Azure AD Groups using Microsoft Graph API so that the user can search for a particular Azure AD Group & then add it in the Target Audience People Picker using
https://github.com/rabwill/generic-target-audience code (https://rabiawilliams.com/spfx/spfx-react-targetaudience/).

Thanks.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,730 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jerryzy 10,571 Reputation points
    2020-08-17T07:44:03.167+00:00

    Hi @Jack-9275 ,

    In SharePoint Framework, you can use GraphHttpClient to connect and get groups:

    Consume the Microsoft Graph in the SharePoint Framework

    Graph API List groups

    And in the solution demo above, if you want to select Office 365 Group, change this to principalType: [PrincipalType.Security] in SampleTargetedComponentWebPart.ts:

    17973-snipaste-2020-08-17-15-45-12.png


    If the response is helpful, please click "Accept Answer" and upvote it.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.