sharepoint-onlineazure-ad-graph-apispfxpnp-jssharepointframework

How to get more than 100 Azure AD users from specific Azure AD Security group using @pnp/graph?


I have to fetch users from Azure AD particular group using @pnp/graph. But I got only 100 users from the group.

Below is my query to get a specific Azure AD group user,

const members = await graph.groups.getById("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX").members();
return members;

Can you have any idea how to get more than 100 users from the group using @pnp/graph?

Below is the reference link for the same, https://pnp.github.io/pnpjs/graph/groups/#group-membership


Solution

  • You can able to partly solve this by using advanced option like, Add a value for Top. You can apply upto 999 it should return that many results. Basically recreate that query and it will return up to 999 entires its enough for addition of using rollup group.

    more than 100 Azure AD users from using @pnp.

    import { graph } from "@pnp/graph";
    graph.users.top(999).get();
    

    For your reference:

    GitHub - pnp/pnpjs: Fluent JavaScript API for SharePoint and Microsoft Graph REST APIs

    https://powerusers.microsoft.com/t5/I-Found-A-Bug/get-group-members-returns-maximum-100-users/td-p/58256/page/2