Graph Toolkit SPFx PeoplePicker (mgt-spfx,mgt-react) does it retieve/can be used with SharePoint groups?

55 views Asked by At

Trying PeoplePicker in SPFx web-part from mgt-spfx,mgt-react ("@microsoft/mgt-react": "3.1.3", "@microsoft/mgt-spfx": "3.1.3") packages and do not see it retrieving SharePoint groups. Is it possible to configure or customize it so SharePoint groups are retrieved?

I have PeoplePicker with type={PersonType.any} working, but do not see SharePoint groups retrieved from the site collection (Team Site template, no M365 group) I am testing on (using online workbench).

1

There are 1 answers

0
Elidjay Ross On

Because mgt-spfx uses the microsoft graph to fetch data it might be unable to retrieve sharepoint groups natively (I couldn't find a property that would do so at least).

You could fetch all SP security groups using this api endpoint: https://{tenant}.sharepoint.com/sites/{sitename}/_api/web/sitegroups

You might need to parse that data but you could then feed it to the mgt-peoplepicker in the people={spGroupArr} property.

An alternative would be to use the sp-dev PeoplePicker which has the option to fetch SharePoint groups: principalTypes={[PrincipalType.SharePointGroup]}

Hope this helps