lect.</p>
<pre><code class="language-TypeScript">import { graphfi, DefaultHeaders } from &quot;@pnp/graph&quot;;
import &quot;@pnp/graph/users&quot;;

const graph = graphfi().using(DefaultHeaders());

const allUsers = [];
let users = await graph.users.top(50).select(&quot;userPrincipalName&quot;, &quot;displayName&quot;).filter(&quot;startswith(displayName, 'A')&quot;).paged();

allUsers.push(...users.value);

while (users.hasNext) {
  users = await users.next();
  allUsers.push(...users.value);
}

console.