Forum Discussion

hidayat3676's avatar
hidayat3676
Copper Contributor
Apr 22, 2021

Not Getting Data from Graph rest api for MS Team

Hi,

I've created an app at https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade

I can do oauth using my credentials and getting token to access secure resource through it, but I'm getting empty result when i query the following api 

https://graph.microsoft.com/v1.0/teams
or
https://graph.microsoft.com/v1.0/users/{userID}/joinedTeams
though I've teams in my teams account but the response return empty result as follows

{
"value": []
}
also the second api return response below
{
"error": {
"code": "ResourceNotFound",
"message": "Resource not found.",
"innerError": {
"date": "2021-04-22T06:34:22",
"request-id": "55e3a10e-6e63-466e-a4ed-c15e2cab56b7",
"client-request-id": "f50412d2-6beb-5af8-170c-7ac4fd27c448"
}
}
}
Can you please clarify how can i get data from MS teams ? data like teams, groups, channels, chats etc using graph api.
 
Thanks.

20 Replies

  • Hi hidayat3676, To list joined teams for user you need application level permissions. Please go through this documentation for more details. 

     

     

    GET https://graph.microsoft.com/v1.0/users/{id}/joinedTeams

     

     

    and to list channels using graph API use

     

    GET https://graph.microsoft.com/v1.0/teams/{team-id}/channels

     

     

    • hidayat3676's avatar
      hidayat3676
      Copper Contributor

      Mamatha-MSFT Hi,

      Thanks for your response

      I already have these permission you can see in the image attach, plus what about my first api teams api which return empty data ?

      • Mamatha-MSFT's avatar
        Mamatha-MSFT
        Icon for Microsoft rankMicrosoft

        Hi hidayat3676, I have gone through your screenshot but few permissions are missing.  

        TeamSettings.Read.All, TeamSettings.ReadWrite.All, User.Read.All, User.ReadWrite.All, Directory.ReadWrite.All

        Please make sure to add these permissions and let us know if the issue still persists. 

        and Get https://graph.microsoft.com/v1.0/teams is not a valid request. 

Resources