fmExcense
fmExcense

Reputation: 1

How to get SharePoint site id from a Microsoft Team channel using Microsoft Graph API?

I am building a custom tab app for Microsoft Teams which needs to list the documents which belong to the channel where the tab app is installed. These documents are hosted on Microsoft SharePoints.

So far, the listing is working using the Microsoft Graph API endpoint https://graph.microsoft.com/beta/groups/{group-id-for-teams}/drive/root/children, see here

The issue with this endpoint is that it lists all the documents for a group, and not a specific channel.

The {group-id-for-teams} is given by the microsoft teams context, with the channel Id.

Is there a way to retrieve only the documents associated to a team channel from a channel id?

Given that if the user is changing the name of a channel, after the channel was created, the site name is not changed. So, we can't rely on the channel name when listing all the documents.

Thanks for your feedback!

Upvotes: 0

Views: 2182

Answers (1)

Keen Jin
Keen Jin

Reputation: 1138

there are no stable correlations between a channel id and a SharePoint folder. So we can't get SharePoint site id from a Microsoft Team channel using Microsoft Graph API.

we can't rely on their names (except for channel "General"), because if the name of the channel is changed through Microsoft Teams, the SharePoint folder name is not changed.

You are right. So though the root/children will return lists all the documents for a group, and almost each specific channel has its corresponding folder. But we may find some channel doesn't have sub folder or some folder doesn't have corresponding channel.

Upvotes: 1

Related Questions