SOLVED
Home

How to get the list of Microsoft Team

Nino Paolo
New Contributor

How to get the list of Microsoft Team

Hi Guys,

 

I'm writing a program that will list all Microsoft Teams.

 

I'm using /beta/groups to list all groups. Then, I check each group using /beta/groups/{group-id}/team to check wether that group is a team or not. I can list few teams but most of it I can't.

 

The response below is returned to the team that I cannot access. Is it because I'm not a member of the group, that's why I can't access it?

 

{
    "error": {
        "code": "AccessDenied",
        "message": "Failed to execute Skype backend request GetThreadRequest. Request Url: https://bn3p-client-dc.msg.skype.com/v1/threads/19:03123d1222474b04ac7982a9f1735374@thread.skype?view=msnp24Equivalent, Request Method: GET,. The server failed to respond correctly. Response Code: Forbidden, Reason: Forbidden...",
    }
}

Is there any other way I can check if a group is a team or not?

 

Please let me know.

 

Thanks.

 

5 Replies

Re: How to get the list of Microsoft Team

I found that I cannot access a Team using /beta/groups/{group-id}/team if I'm not a member or owner of that Team. That's why it returns Forbidden 403 response.

 

{
    "error": {
        "code": "AccessDenied",
        ...
     }
     ...
}

My question is, is there any other way to tell whether that certain group is a Team or not?

 

Please help. Thank you.

Re: How to get the list of Microsoft Team

The only methods that we currently have available is to indeed query the Groups you are a member of. And yeah, I agree it sucks. Supposedly some better method is coming soon via the API, although I wont be surprised if it's the same thing...

Solution

Re: How to get the list of Microsoft Team

Thank you for the quick reply @Vasil Michev

 

I think I've found a solution... by using /beta/group/{group-id}/team if a group is not a Team, I found that the response code is 404 Not Found. If it's a Team, the response code is either 200 OK or 403 Forbidden. 

Highlighted

Re: How to get the list of Microsoft Team

Is there a reason this function wasn't built? Is there a security or privacy concern? It does seem like a basic need for administrators to help curate and guide new adopters of this capability.

Re: How to get the list of Microsoft Team

Hi Nino,

 

Would it be possible for you share the code, as I am also puzzled, how to restructure all MS Teams for an Organization. Help would be highly Appreciated!!

Related Conversations
How can I delete Teams free organization?
Kazuaki Tauchi in Microsoft Teams on
5 Replies
Auto-Add new employees
Mathias Koprek in Microsoft Teams on
10 Replies
Linking OneDrive to New Microsoft Teams Channel
Anonymous in Microsoft Teams on
7 Replies
Adding an Existing OneNote notebook to Teams
CC Adeyemo in Microsoft Teams on
21 Replies