Search code examples
azureazure-active-directorymicrosoft-graph-apioffice365access-token

How to get a list of channels in Microsoft Teams using MS Graph?


I'm getting the user's token and submitting a request to /me/joinedTeams and get the teams IDs of the user.

For each team id, I want to get a list of available channels by sending a request to /teams/{id}/channels, however i am getting the following error:

{
  "error": {
    "code": "Forbidden",
    "message": "Failed to execute Skype backend request GetThreadS2SRequest.",
    "innerError": {
      "date": "2021-03-12T07:08:38",
      "request-id": "2f1b9408-e7db-4245-be6f-0ec6d67ff160",
      "client-request-id": "2f1b9408-e7db-4245-be6f-0ec6d67ff160"
    }
  }
}

How do I fix this?

After which I want to send a request to /teams/{id}/channels and get drive-id. And at the end, for each drive-id, get a list of files - /drives/{drive-id}/root/search(q='').


Solution

  • As I said in the comments, this api call does not support personal accounts, you must use a work account.

    enter image description here

    This is my test result:

    enter image description here