Deleting a Team via Graph API

%3CLINGO-SUB%20id%3D%22lingo-sub-729152%22%20slang%3D%22en-US%22%3EDeleting%20a%20Team%20via%20Graph%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-729152%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20using%20the%20below%20API%20to%20delete%20the%20Team%3A%3CBR%20%2F%3E%3CBR%20%2F%3EDELETE%26nbsp%3B%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fgroups%2F%7Bid%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fgroups%2F%7Bid%3C%2FA%3E%7D%3CBR%20%2F%3E%3CBR%20%2F%3EThis%20successfully%20deletes%20the%20group%2C%20but%20it%20does%20not%20delete%20the%20team.%20I%20still%20see%20the%20team%20in%20the%20Microsoft%20Teams%20workspace%20as%20well%20as%20being%20able%20to%20get%20information%20about%20the%20team%20via%20Graph%20API.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EAm%20I%20doing%20anything%20wrong%20here%3F%20The%20documentation%20says%20%22Delete%20the%20team%20and%20its%20associated%20group.%22%20at%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fresources%2Fteam%3Fview%3Dgraph-rest-1.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fresources%2Fteam%3Fview%3Dgraph-rest-1.0%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThanks%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EPaulomi%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-729152%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-730708%22%20slang%3D%22en-US%22%3ERe%3A%20Deleting%20a%20Team%20via%20Graph%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-730708%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F368500%22%20target%3D%22_blank%22%3E%40paulomi07%3C%2FA%3E%20A%20group%20in%20Microsoft%20Teams%20can%20be%20deleted%20whereas%20a%20team%20is%20archived.%20Could%20you%20please%20try%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fteam-archive%3Fview%3Dgraph-rest-beta%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EArchive%20team%3C%2FA%3E%20and%20see%20if%20that%20helps%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-744715%22%20slang%3D%22en-US%22%3ERe%3A%20Deleting%20a%20Team%20via%20Graph%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-744715%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F368500%22%20target%3D%22_blank%22%3E%40paulomi07%3C%2FA%3E%26nbsp%3BNo%2C%20nothing%20wrong.%20This%20is%20the%20correct%20way%20to%20delete%20a%20Team%20through%20the%20API.%20Problem%20here%20is%20%22timing%22%3A%20Teams%20and%20the%20Teams%20API%20(exposed%20through%20Graph)%20runs%20on%20its%20own%20backend%2C%20which%20caches%20information%20from%20Azure%20AD.%20Due%20to%20this%2C%20changes%20made%20on%20Azure%20AD%20side%20(like%20deleting%20the%20Group)%20don't%20translate%20immediately%20on%20the%20Teams%20side.%20It%20takes%20some%20time%20to%20become%20visible%20there.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBy%20now%2C%20your%20Team%20should%20have%20disappeared%20from%20the%20list.%20If%20not%2C%20please%20let%20me%20know!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-892934%22%20slang%3D%22en-US%22%3ERe%3A%20Deleting%20a%20Team%20via%20Graph%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-892934%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F4392%22%20target%3D%22_blank%22%3E%40Yannick%20Reekmans%3C%2FA%3E%26nbsp%3B%20How%20much%20time%20takes%20to%20be%20deleted%20%3F%20Because%20depending%20of%20team%20is%201%20hour%20%2C%20some%20times%20is%203%20h%20%2C%201%20day.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%C2%B4s%20hard%20to%20explain%20to%20the%20users%20this%20behavior.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-892944%22%20slang%3D%22en-US%22%3ERe%3A%20Deleting%20a%20Team%20via%20Graph%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-892944%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F46349%22%20target%3D%22_blank%22%3E%40Ruben%20Toribio%3C%2FA%3E%26nbsp%3BThere%20isn't%20a%20%22fixed%22%20timing%2C%20we're%20seeing%20the%20same%20type%20of%20delays...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-892945%22%20slang%3D%22en-US%22%3ERe%3A%20Deleting%20a%20Team%20via%20Graph%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-892945%22%20slang%3D%22en-US%22%3EThanks%20%2C%20at%20least%20i%C2%B4m%20not%20alone%20on%20this%20...%20Hope%20this%20will%20be%20fixed%20in%20short%20term%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-896343%22%20slang%3D%22en-US%22%3ERe%3A%20Deleting%20a%20Team%20via%20Graph%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-896343%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F46349%22%20target%3D%22_blank%22%3E%40Ruben%20Toribio%3C%2FA%3E%26nbsp%3BAre%20you%20seeing%20delays%20that%20are%20longer%20than%2024h%3F%2024h%20should%20be%20the%20maximum%20delay...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-959018%22%20slang%3D%22en-US%22%3ERe%3A%20Deleting%20a%20Team%20via%20Graph%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-959018%22%20slang%3D%22en-US%22%3E%3CP%3EI%20haven%C2%B4t%20deployed%20this%20feature%20in%20production%20%2C%20but%20in%20some%20examples%20it%20took%2024h.%26nbsp%3B%20For%20me%20it%20should%20be%20almost%20immediate.%26nbsp%3B%20%26nbsp%3BThe%20same%20when%20you%20delete%20an%20office%20365%20group%20and%20the%20SharePoint%20site%20stay%20for%20more%20than%2024h.%26nbsp%3B%20%26nbsp%3BThe%20process%20of%20deletion%20in%20graph%20api%20doesn%C2%B4t%20work%20properly.%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F4392%22%20target%3D%22_blank%22%3E%40Yannick%20Reekmans%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1476930%22%20slang%3D%22en-US%22%3ERe%3A%20Deleting%20a%20Team%20via%20Graph%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1476930%22%20slang%3D%22en-US%22%3E%3CP%3EI%20second%20this%2C%20we%20have%20%26gt%3B24h%20delays%20at%20multiple%20customers.%20O365%20group%20is%20deleted%2C%20but%20the%20MS%20Team%20remains%20listed%20in%20the%20Teams%20UI%20for%20quite%20some%20time...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1740585%22%20slang%3D%22en-US%22%3ERe%3A%20Deleting%20a%20Team%20via%20Graph%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1740585%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F9922%22%20target%3D%22_blank%22%3E%40Pieter%20Heemeryck%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESame%20for%20me.%20Did%20some%20performance%20testing%20(bulk%20creation%20of%20Teams%2C%201%2C%204%2C%208%20concurrent%20worker%20process%2C%20to%20prep%20for%20a%20large%20migration)%2C%20ended%20up%20with%201200%20Teams%20in%20mijn%20'developer'%20tenant.%3C%2FP%3E%3CP%3EDeleted%20Teams%20weeks%20ago%20(also%20double%20checked%2C%20all%20related%20items%3A%20Groups%2C%20sites%20are%20gone%2C%20also%20hard%20deleted%20%2F%20from%20recycle%20bin).%20Teams%20still%20show%20up%20in%20mijn%20webclient%2C%20desktop%20client%20(and%20even%20on%20a%20iPad%20with%20I%20connected%20to%20this%20tenant%20after%20the%20deletions).%3C%2FP%3E%3CP%3EVery%20anyoing%2C%20no%20way%20to%20reach%20the%20programmatically%20it%20seems%2C%20only%20thing%20I%20can%20do%20is%20to%20remove%20them%201%20by%201%20via%20GUI%20(I%20wasn't%20planning%20to%20do%20so%20...).%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

I am using the below API to delete the Team:

DELETE https://graph.microsoft.com/v1.0/groups/{id}

This successfully deletes the group, but it does not delete the team. I still see the team in the Microsoft Teams workspace as well as being able to get information about the team via Graph API. 

 

Am I doing anything wrong here? The documentation says "Delete the team and its associated group." at https://docs.microsoft.com/en-us/graph/api/resources/team?view=graph-rest-1.0

 

Thanks,

Paulomi

9 Replies
Highlighted

@paulomi07 A group in Microsoft Teams can be deleted whereas a team is archived. Could you please try Archive team and see if that helps?

Highlighted

@paulomi07 No, nothing wrong. This is the correct way to delete a Team through the API. Problem here is "timing": Teams and the Teams API (exposed through Graph) runs on its own backend, which caches information from Azure AD. Due to this, changes made on Azure AD side (like deleting the Group) don't translate immediately on the Teams side. It takes some time to become visible there.

 

By now, your Team should have disappeared from the list. If not, please let me know!

Highlighted

@Yannick Reekmans  How much time takes to be deleted ? Because depending of team is 1 hour , some times is 3 h , 1 day.

 

It´s hard to explain to the users this behavior.

@Ruben Toribio There isn't a "fixed" timing, we're seeing the same type of delays...

Highlighted
Thanks , at least i´m not alone on this ... Hope this will be fixed in short term
Highlighted

@Ruben Toribio Are you seeing delays that are longer than 24h? 24h should be the maximum delay...

Highlighted

I haven´t deployed this feature in production , but in some examples it took 24h.  For me it should be almost immediate.   The same when you delete an office 365 group and the SharePoint site stay for more than 24h.   The process of deletion in graph api doesn´t work properly. @Yannick Reekmans 

Highlighted

I second this, we have >24h delays at multiple customers. O365 group is deleted, but the MS Team remains listed in the Teams UI for quite some time...

Highlighted

@Pieter Heemeryck 

Same for me. Did some performance testing (bulk creation of Teams, 1, 4, 8 concurrent worker process, to prep for a large migration), ended up with 1200 Teams in mijn 'developer' tenant.

Deleted Teams weeks ago (also double checked, all related items: Groups, sites are gone, also hard deleted / from recycle bin). Teams still show up in mijn webclient, desktop client (and even on a iPad with I connected to this tenant after the deletions).

Very anyoing, no way to reach the programmatically it seems, only thing I can do is to remove them 1 by 1 via GUI (I wasn't planning to do so ...).