I want to show Mail-Enable security Group Names in select tag.
Can someone please tell how can I get the group names using SPFx react?
I want to show Mail-Enable security Group Names in select tag.
Can someone please tell how can I get the group names using SPFx react?
You have to use the Microsoft Graph APIs to get the details of Mail-enabled security groups.
For example:
You can use the query endpoint like below:
https://graph.microsoft.com/v1.0/groups?$filter=mailEnabled eq true and securityEnabled eq true
Documentation: Working with groups in Microsoft Graph
Also, check this documentation: Consume the Microsoft Graph in the SharePoint Framework
This may return mail enabled M365 groups as well. Usually M365 groups have 'Unified' value in groupType
property. So you can filter results based on this property in your code to exclude M365 groups from results array.
Similar thread (not worked for me): Query Mail Enabled Security group from Graph API .net SDK