Team identifier for Private and Shared Channels using MS Graph.
I’m in the process of creating an application for Microsoft Teams that requires the ability to read, write, create, and delete documents within various Channels. The functionality is currently operational for Standard Channels. However, I’ve encountered an issue when dealing with Private or Shared Channels.
The application is developed using Blazor, .NET 8.0, and Visual Studio 2022, relying solely on direct REST queries to the Microsoft Graph REST API.
- Upon initialization, the application retrieves the TeamsContext object containing the Team.GroupId, which is also the TeamsId.
- This TeamsId is correctly obtained when interacting with Standard Channels.
- Conversely, it remains blank when attempting to access Private or Shared Channels.
The TeamsId is essential for subsequent operations with the Microsoft Graph REST API, as file-related methods in Channels necessitate this identifier. Despite this, I’ve been unable to find a solution since the context provides only the Internal ID of the Team where the Channel is located.
My attempts to obtain the TeamsId finding first the list of Teams accessible to the user, using methods like JoinedTeams or AssociatedTeams and filtering by Internal ID, have been unsuccessful as these queries return an empty Internal ID for all Teams. (Note: The ChannelId of a Private Channel has the same value as the InternalId of its Team).
To summarize, I’m seeking advice on how to retrieve the TeamsId for Private or Shared Channels associated with a specific Teams, using the Microsoft Graph REST API.
Any assistance would be greatly appreciated.
Gr.,
Gustavo
PS: The original message was initially posted in the Microsoft 365 Q&A section (https://answers.microsoft.com/en-us/msteams/forum/all/team-identifier-for-private-and-shared-channels/7038b7b2-549c-42fb-bd84-1500a4277851); however, it was recommended by the moderator that this particular question would be better suited for a different Q&A platform