SOLVED

Auto approve a join request

%3CLINGO-SUB%20id%3D%22lingo-sub-1967577%22%20slang%3D%22en-US%22%3EAuto%20approve%20a%20join%20request%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1967577%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20everyone%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ewe%C2%B4re%20currently%20trying%20to%20auto%20approve%20join%20requests%20for%20Microsoft%20Teams.%3C%2FP%3E%3CP%3EI%20just%20checked%20the%20whole%20process%20and%20found%20out%20that%20through%20this%20link%20you%20can%20send%20a%20POST%20%3CSPAN%3Eapproval%20which%20is%20accepting%20the%20invite.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-html%22%3E%3CCODE%3Ehttps%3A%2F%2Fteams.microsoft.com%2Fapi%2Fmt%2Femea%2Fbeta%2Fteams%2FjoinRequestAdminAction%3FsilentAction%3Dfalse%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20Body%20included%20in%20this%20POST%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-html%22%3E%3CCODE%3E%7B%22GroupId%22%3A%22123%22%2C%22UserMri%22%3A%221%3Aorgid%3A123%22%2C%22ActionType%22%3A%22Accept%22%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3BHowever%20when%20I%C2%B4m%20trying%20to%20do%20this%20on%20my%20own%20with%20an%20%22authorized%20user%22%20I%C2%B4m%20getting%20the%20error%20message%20%22Unauthorized%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnybody%20a%20idea%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBR%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1967577%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdministrator%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2000613%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20approve%20a%20join%20request%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2000613%22%20slang%3D%22en-US%22%3EAny%20ideas%20anyone%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2023379%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20approve%20a%20join%20request%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2023379%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F398907%22%20target%3D%22_blank%22%3E%40belasor%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThat's%20an%20internal%20API%20used%20by%20the%20Teams%20UI%2C%20it's%20not%20documented%20and%20realistically%20you'll%20struggle%20to%20achieve%20authentication%20for%20any%20other%20process%20to%20call%20it.%20There%20is%20an%20unofficial%20powershell%20that%20tries%2C%20but%20it's%20majorly%20unsupported.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20official%20supported%20apis%20for%20Teams%20are%20at%20graph.microsoft.com.%20There%20isn't%20an%20api%20to%20specifically%20approve%20a%20request%2C%20but%20you%20can%20just%20add%20a%20member%2C%20this%20would%20clear%20the%20pending%20request%20anyway.%20See%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fteam-post-members%3Fview%3Dgraph-rest-beta%26amp%3Btabs%3Dhttp%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAdd%20member%20to%20team%20-%20Microsoft%20Graph%20beta%20%7C%20Microsoft%20Docs%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI'm%20not%20sure%20I%20really%20see%20what%20you%20are%20trying%20to%20achieve%2C%20why%20not%20make%20the%20group%20Public%20then%20there%20simply%20isn't%20a%20need%20for%20a%20user%20to%20be%20approved%20or%20added%2C%20they%20just%20join%20immediately.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2023381%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20approve%20a%20join%20request%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2023381%22%20slang%3D%22en-US%22%3EYeah%20the%20approach%20seems%20a%20bit%20off%20here.%20What%20is%20the%20goal%20of%20auto%20approving%20vs%20just%20making%20it%20public%3F%20%3CBR%20%2F%3E%3CBR%20%2F%3EAnother%20approach%20could%20be%20to%20utilize%20join%20codes.%20I'm%20pretty%20sure%20you%20could%20find%20a%20way%20to%20run%20whatever%20POST%20happens%20when%20someone%20enter's%20these%20codes%20into%20the%20join%20screen%20and%20replicate%20that%20into%20some%20automation.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fsupport.microsoft.com%2Fen-us%2Foffice%2Fcreate-a-link-or-a-code-for-joining-a-team-11b0de3b-9288-4cb4-bc49-795e7028296f%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsupport.microsoft.com%2Fen-us%2Foffice%2Fcreate-a-link-or-a-code-for-joining-a-team-11b0de3b-9288-4cb4-bc49-795e7028296f%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2040217%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20approve%20a%20join%20request%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2040217%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F178440%22%20target%3D%22_blank%22%3E%40Steven%20Collier%3C%2FA%3E%26nbsp%3Band%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F869%22%20target%3D%22_blank%22%3E%40Chris%20Webb%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethank%20you%20both%20for%20the%20reply.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20the%20problem%20we%20have%20is%20a%20little%20bit%20complicated.%20We%20have%20a%20few%20users%20within%20the%20company%20which%20we%20want%20to%20exclude%20from%20all%20public%20Teams.%20Unfortunately%20we%20couldn%C2%B4t%20find%20anything%20to%20resolve%20that%20problem.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAn%20idea%20was%20to%20auto%20approve%20all%20join%20requests%20for%20teams%20and%20just%20reject%20all%20requests%20from%20people%20which%20are%20part%20of%20group%20%22forbidden%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%C2%B4ve%20tried%20a%20lot%2C%20sensitive%20labels%20for%20groups%2C%20Graph%20API%20and%20looking%20through%20azure%20but%20we%20couldn%C2%B4t%20find%20anything.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi everyone,

 

we´re currently trying to auto approve join requests for Microsoft Teams.

I just checked the whole process and found out that through this link you can send a POST approval which is accepting the invite.

 

https://teams.microsoft.com/api/mt/emea/beta/teams/joinRequestAdminAction?silentAction=false

 

The Body included in this POST:

 

{"GroupId":"123","UserMri":"1:orgid:123","ActionType":"Accept"}

 

 However when I´m trying to do this on my own with an "authorized user" I´m getting the error message "Unauthorized".

 

Anybody a idea?

 

BR

6 Replies
Any ideas anyone?
best response confirmed by ThereseSolimeno (Microsoft)
Solution

Hi @belasor ,

 

That's an internal API used by the Teams UI, it's not documented and realistically you'll struggle to achieve authentication for any other process to call it. There is an unofficial powershell that tries, but it's majorly unsupported.

 

The official supported apis for Teams are at graph.microsoft.com. There isn't an api to specifically approve a request, but you can just add a member, this would clear the pending request anyway. See Add member to team - Microsoft Graph beta | Microsoft Docs.

 

I'm not sure I really see what you are trying to achieve, why not make the group Public then there simply isn't a need for a user to be approved or added, they just join immediately.

Yeah the approach seems a bit off here. What is the goal of auto approving vs just making it public?

Another approach could be to utilize join codes. I'm pretty sure you could find a way to run whatever POST happens when someone enter's these codes into the join screen and replicate that into some automation.

https://support.microsoft.com/en-us/office/create-a-link-or-a-code-for-joining-a-team-11b0de3b-9288-...

Hi @Steven Collier and @Chris Webb,

 

thank you both for the reply.

 

So the problem we have is a little bit complicated. We have a few users within the company which we want to exclude from all public Teams. Unfortunately we couldn´t find anything to resolve that problem.

 

An idea was to auto approve all join requests for teams and just reject all requests from people which are part of group "forbidden".

 

We´ve tried a lot, sensitive labels for groups, Graph API and looking through azure but we couldn´t find anything.

 

 

@belasor I appreciate it's a complex solution that needs E5, but Information Barriers can do exactly this.

@Steven Collier thank you very much for the help.

 

We now bought some licenses for test purposes and I´m setting up the prerequisite.

Unfortunately I can´t see a way to exclude User from a Teams, when the prefix is "ABC" as a example. 

Did I miss something in all the tutorials?

 

Best regards