Share via

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.

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments

Answer accepted by question author

ZhengyuGuo 10,591 Reputation points Moderator
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.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

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