SOLVED

How to query to find all users who are managed by a specified individual

%3CLINGO-SUB%20id%3D%22lingo-sub-1229899%22%20slang%3D%22en-US%22%3EHow%20to%20query%20to%20find%20all%20users%20who%20are%20managed%20by%20a%20specified%20individual%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1229899%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EWondering%20if%20it%20is%20possible%20to%20query%20(using%20PnP%20JS)%20to%20get%20user%20profiles%20for%20all%20users%20who%20are%20managed%20by%20a%20specified%20individual%3F%3C%2FP%3E%3CP%3EIm%20guessing%20it%20can%20done%20using%26nbsp%3BclientPeoplePickerSearchUser%20(%3CA%20href%3D%22https%3A%2F%2Fpnp.github.io%2Fpnpjs%2Fsp%2Fprofiles%2F%23search-a-user-or-group%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fpnp.github.io%2Fpnpjs%2Fsp%2Fprofiles%2F%23search-a-user-or-group%3C%2FA%3E)%2C%20but%20I%20am%20not%20sure%20how%20to%20structure%20a%20query%20based%20on%20the%20Manager%20profile%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1229899%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAPIs%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPnP%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EUserProfile%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1247980%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20query%20to%20find%20all%20users%20who%20are%20managed%20by%20a%20specified%20individual%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1247980%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F42656%22%20target%3D%22_blank%22%3E%40Nigel%20Witherdin%3C%2FA%3E%3C%2FP%3E%3CP%3EAchieved%20this%20with%20MS%20Graph%20API%20call%20to%20get%20a%20users%20%22directReports%22%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1248936%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20query%20to%20find%20all%20users%20who%20are%20managed%20by%20a%20specified%20individual%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1248936%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F42656%22%20target%3D%22_blank%22%3E%40Nigel%20Witherdin%3C%2FA%3E%26nbsp%3B%20there's%20also%20the%20Office%20365%20Users%20%3CEM%3EGet%20Direct%20reports%20(V2)%3C%2FEM%3E%20action%20in%20Power%20Automate%20which%20will%20get%20the%20list%20quickly%20and%20easily.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERob%3CBR%20%2F%3ELos%20Gallardos%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%20color%3D%22%23003366%22%3EMicrosoft%20Power%20Automate%20Community%20Super%20User%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

Hi,

Wondering if it is possible to query (using PnP JS) to get user profiles for all users who are managed by a specified individual?

Im guessing it can done using clientPeoplePickerSearchUser (https://pnp.github.io/pnpjs/sp/profiles/#search-a-user-or-group), but I am not sure how to structure a query based on the Manager profile

Thanks!

2 Replies
best response confirmed by Nigel Witherdin (Contributor)
Solution

@Nigel Witherdin

Achieved this with MS Graph API call to get a users "directReports" 

@Nigel Witherdin  there's also the Office 365 Users Get Direct reports (V2) action in Power Automate which will get the list quickly and easily.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User