List channels
Article
01/11/2023
5 minutes to read
20 contributors
Feedback
In this article
Namespace: microsoft.graph
Retrieve the list of channels in this team .
Note: Guest users can't see private or shared channels that they aren't members of in the response for this API.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions .
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
Channel.ReadBasic.All, ChannelSettings.Read.All, ChannelSettings.ReadWrite.All, Group.Read.All**, Group.ReadWrite.All**, Directory.Read.All**, Directory.ReadWrite.All**
Delegated (personal Microsoft account)
Not supported.
Application
ChannelSettings.Read.Group*, ChannelSettings.ReadWrite.Group*, Channel.ReadBasic.All, ChannelSettings.Read.All, ChannelSettings.ReadWrite.All, Group.Read.All**, Group.ReadWrite.All**, Directory.Read.All**, Directory.ReadWrite.All**
Note :
Permissions marked with * use resource-specific consent .
Permissions marked with ** are supported only for backward compatibility. We recommend that you update your solutions to use an alternative permission listed in the previous table and avoid using these permissions going forward.
Note : This API supports admin permissions. Global admins and Microsoft Teams service admins can access teams that they are not a member of.
HTTP request
GET /teams/{team-id}/channels
Optional query parameters
This method supports the $filter and $select OData query parameters to help customize the response.
Header
Value
Authorization
Bearer {token}. Required.
Request body
Do not supply a request body for this method.
Response
If successful, this method returns a 200 OK
response code and collection of Channel objects in the response body.
Examples
Example 1: List all channels
Request
The following example shows a request to list all channels.
GET https://graph.microsoft.com/v1.0/teams/893075dd-2487-4122-925f-022c42e20265/channels
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var channels = await graphClient.Teams["{team-id}"].Channels
.Request()
.GetAsync();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
let channels = await client.api('/teams/893075dd-2487-4122-925f-022c42e20265/channels')
.get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
ChannelCollectionPage channels = graphClient.teams("893075dd-2487-4122-925f-022c42e20265").channels()
.buildRequest()
.get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
result, err := graphClient.TeamsById("team-id").Channels().Get(context.Background(), nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestResult = $graphServiceClient->teamsById('team-id')->channels()->get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
The following is the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-type: application/json
{
"value": [
{
"id": "19:561fbdbbfca848a484f0a6f00ce9dbbd@thread.tacv2",
"createdDateTime": "2020-05-27T19:22:25.692Z",
"displayName": "General",
"description": "AutoTestTeam_20210311_150740.2550_fim3udfdjen9",
"membershipType": "standard"
}
]
}
Example 2: List all private channels
Request
The following example shows a request to list all private channels.
GET https://graph.microsoft.com/v1.0/teams/64c323f2-226a-4e64-8ba4-3e6e3f7b9330/channels?$filter=membershipType eq 'private'
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var channels = await graphClient.Teams["{team-id}"].Channels
.Request()
.Filter("membershipType eq 'private'")
.GetAsync();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
let channels = await client.api('/teams/64c323f2-226a-4e64-8ba4-3e6e3f7b9330/channels')
.filter('membershipType eq \'private\'')
.get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
ChannelCollectionPage channels = graphClient.teams("64c323f2-226a-4e64-8ba4-3e6e3f7b9330").channels()
.buildRequest()
.filter("membershipType eq 'private'")
.get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestFilter := "membershipType eq 'private'"
requestParameters := &graphconfig.TeamItemChannelsRequestBuilderGetQueryParameters{
Filter: &requestFilter,
}
configuration := &graphconfig.TeamItemChannelsRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
result, err := graphClient.TeamsById("team-id").Channels().Get(context.Background(), configuration)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestConfiguration = new ChannelsRequestBuilderGetRequestConfiguration();
$queryParameters = new ChannelsRequestBuilderGetQueryParameters();
$queryParameters->filter = "membershipType eq 'private'";
$requestConfiguration->queryParameters = $queryParameters;
$requestResult = $graphServiceClient->teamsById('team-id')->channels()->get($requestConfiguration);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
The following is an example of the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-type: application/json
{
"value": [
{
"id": "19:982abbfca323a582f0a6d00ae2deca@thread.tacv2",
"createdDateTime": "2020-05-27T19:22:25.692Z",
"displayName": "General",
"description": "test private team",
"membershipType": "private"
}
]
}
Example 3: List all shared channels
Request
The following example shows a request to list all shared channels.
GET https://graph.microsoft.com/v1.0/teams/6a720ba5-7373-463b-bc9f-4cd04b5c6742/channels?$filter=membershipType eq 'shared'
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var channels = await graphClient.Teams["{team-id}"].Channels
.Request()
.Filter("membershipType eq 'shared'")
.GetAsync();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
let channels = await client.api('/teams/6a720ba5-7373-463b-bc9f-4cd04b5c6742/channels')
.filter('membershipType eq \'shared\'')
.get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
ChannelCollectionPage channels = graphClient.teams("6a720ba5-7373-463b-bc9f-4cd04b5c6742").channels()
.buildRequest()
.filter("membershipType eq 'shared'")
.get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestFilter := "membershipType eq 'shared'"
requestParameters := &graphconfig.TeamItemChannelsRequestBuilderGetQueryParameters{
Filter: &requestFilter,
}
configuration := &graphconfig.TeamItemChannelsRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
result, err := graphClient.TeamsById("team-id").Channels().Get(context.Background(), configuration)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestConfiguration = new ChannelsRequestBuilderGetRequestConfiguration();
$queryParameters = new ChannelsRequestBuilderGetQueryParameters();
$queryParameters->filter = "membershipType eq 'shared'";
$requestConfiguration->queryParameters = $queryParameters;
$requestResult = $graphServiceClient->teamsById('team-id')->channels()->get($requestConfiguration);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
The following is an example of the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-type: application/json
Content-length: 262
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#teams('6a720ba5-7373-463b-bc9f-4cd04b5c6742')/channels",
"@odata.count": 1,
"value": [
{
"id": "19:LpxShHZZh9utjNcEmUS5aOEP9ASw85OUn05NcWYAhX81@thread.tacv2",
"createdDateTime": null,
"displayName": "shared channel-01",
"description": "this is the shared channel description",
"isFavoriteByDefault": null,
"email": "",
"webUrl": "https://teams.microsoft.com/l/channel/19%3ALpxShHZZh9utjNcEmUS5aOEP9ASw85OUn05NcWYAhX81%40thread.tacv2/shared%20channel-01?groupId=6a720ba5-7373-463b-bc9f-4cd04b5c6742&tenantId=df81db53-c7e2-418a-8803-0e68d4b88607",
"membershipType": "shared",
"moderationSettings": null
}
]
}