Microsot Graph API get all users by managers name

%3CLINGO-SUB%20id%3D%22lingo-sub-1825891%22%20slang%3D%22en-US%22%3EMicrosot%20Graph%20API%20get%20all%20users%20by%20managers%20name%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1825891%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20are%20developing%20a%20people%20search%20webpart%20for%20an%20organisation%20with%201000's%20of%20users.%20One%20request%20we%20had%20was%20to%20add%20a%20text%20input%20that%20would%20filter%20the%20users%20by%20a%20managers%20name.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20new%20to%20Microsoft%20graph%20and%20struggling%20to%20come%20up%20with%20anything%20that%20will%20bring%20back%20these%20results.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20only%20way%20I%20can%20see%20how%20to%20do%20it%20is%20to%20do%20the%20following%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3EGet%20all%20the%20users%20when%20the%20webpart%20is%20initially%20rendered%20by%20doing%20multiple%20calls%20to%20the%20graph%20api%20users%20endpoint.%20Multiple%20calls%20are%20needed%20to%20get%20the%20users%20in%20batches%20(due%20to%20the%20top%20limit%20of%20999%20results%20in%20one%20call).%3C%2FLI%3E%3CLI%3EIterate%20over%20these%20results%20and%20get%20the%20manager%20of%20each%20user.%3C%2FLI%3E%3CLI%3EFilter%20the%20results%20based%20on%20managers%20name.%3C%2FLI%3E%3C%2FUL%3E%3CP%3EI%20feel%20like%20this%20will%20be%20very%20slow%20and%20cumbersome.%20I%20have%20looked%20at%20using%20the%20expand%20functionality%20on%20the%20query%20but%20can't%20figure%20out%20what%20I%20need%20to%20do%2C%20or%20if%20it%20is%20even%20possible%20to%20do%20this.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20insight%20would%20be%20much%20appreciated.%20Haven't%20been%20able%20to%20find%20anything%20throughout%20my%20web%20searches.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1825891%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EGraph%20API%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Espfx%20webpart%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
New Contributor

Hi all,

 

We are developing a people search webpart for an organisation with 1000's of users. One request we had was to add a text input that would filter the users by a managers name.

 

I am new to Microsoft graph and struggling to come up with anything that will bring back these results.

 

The only way I can see how to do it is to do the following:

 

  • Get all the users when the webpart is initially rendered by doing multiple calls to the graph api users endpoint. Multiple calls are needed to get the users in batches (due to the top limit of 999 results in one call).
  • Iterate over these results and get the manager of each user.
  • Filter the results based on managers name.

I feel like this will be very slow and cumbersome. I have looked at using the expand functionality on the query but can't figure out what I need to do, or if it is even possible to do this.

 

Any insight would be much appreciated. Haven't been able to find anything throughout my web searches. 

0 Replies