Namespace: microsoft.graph
Get the list of channels either in this team or shared with this team (incoming channels).
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
❌ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type |
Least privileged permissions |
Higher privileged permissions |
Delegated (work or school account) |
Channel.ReadBasic.All |
ChannelSettings.Read.All, ChannelSettings.ReadWrite.All |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
Channel.ReadBasic.All |
ChannelSettings.Read.All, ChannelSettings.ReadWrite.All |
Note: This API supports admin permissions. Microsoft Teams service admins can access teams that they are not a member of.
HTTP request
GET /teams/{team-id}/allChannels
Optional query parameters
This method supports the $filter
and $select
OData query parameters to help customize the response.
Populating the email and moderationSettings properties for a channel is an expensive operation that results in slow performance. Use $select
to exclude the email and moderationSettings properties to improve performance.
Request body
Don't supply a request body for this method.
Response
If successful, this method returns a 200 OK
response code and a collection of channel objects in the response body. The response also includes the @odata.id property which can be used to access the channel and run other operations on the channel object.
Note
Currently, invoking the URL returned from the @odata.id property fails for cross-tenant shared channels. You can solve this issue if you remove the /tenants/{tenant-id}
part from the URL before you call this API. For more information, see Known issues with Microsoft Graph.
Examples
Example 1: List all channels
Request
The following example shows a request.
GET https://graph.microsoft.com/v1.0/teams/893075dd-2487-4122-925f-022c42e20265/allChannels
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teams["{team-id}"].AllChannels.GetAsync();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
allChannels, err := graphClient.Teams().ByTeamId("team-id").AllChannels().Get(context.Background(), nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
ChannelCollectionResponse result = graphClient.teams().byTeamId("{team-id}").allChannels().get();
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 allChannels = await client.api('/teams/893075dd-2487-4122-925f-022c42e20265/allChannels')
.get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->teams()->byTeamId('team-id')->allChannels()->get()->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.teams.by_team_id('team-id').all_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 example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": [
{
"@odata.id": "https://graph.microsoft.com/v1.0/tenants/b3246f44-b4gb-4627-96c6-25b18fa2c910/teams/893075dd-2487-4122-925f-022c42e20265/channels/19:[email protected]",
"id": "19:[email protected]",
"createdDateTime": "2020-05-27T19:22:25.692Z",
"displayName": "General",
"description": "AutoTestTeam_20210311_150740.2550_fim3udfdjen9",
"membershipType": "standard",
"tenantId": "b3246f44-b4gb-4627-96c6-25b18fa2c910",
"isArchived": false
},
{
"@odata.id": "https://graph.microsoft.com/v1.0/tenants/b3246f44-b4gb-5678-96c6-25b18fa2c910/teams/893075dd-5678-5634-925f-022c42e20265/channels/19:[email protected]",
"id": "19:[email protected]",
"createdDateTime": "2020-05-27T19:22:25.692Z",
"displayName": "Shared channel from Contoso",
"membershipType": "shared",
"tenantId": "b3246f44-b4gb-5678-96c6-25b18fa2c910",
"isArchived": false
}
]
}
Example 2: List all shared channels
Request
The following example shows a request.
GET https://graph.microsoft.com/v1.0/teams/893075dd-2487-4122-925f-022c42e20265/allChannels?$filter=membershipType eq 'shared'
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teams["{team-id}"].AllChannels.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Filter = "membershipType eq 'shared'";
});
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphteams "github.com/microsoftgraph/msgraph-sdk-go/teams"
//other-imports
)
requestFilter := "membershipType eq 'shared'"
requestParameters := &graphteams.ItemAllChannelsRequestBuilderGetQueryParameters{
Filter: &requestFilter,
}
configuration := &graphteams.ItemAllChannelsRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
allChannels, err := graphClient.Teams().ByTeamId("team-id").AllChannels().Get(context.Background(), configuration)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
ChannelCollectionResponse result = graphClient.teams().byTeamId("{team-id}").allChannels().get(requestConfiguration -> {
requestConfiguration.queryParameters.filter = "membershipType eq 'shared'";
});
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 allChannels = await client.api('/teams/893075dd-2487-4122-925f-022c42e20265/allChannels')
.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.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Teams\Item\AllChannels\AllChannelsRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new AllChannelsRequestBuilderGetRequestConfiguration();
$queryParameters = AllChannelsRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->filter = "membershipType eq 'shared'";
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->teams()->byTeamId('team-id')->allChannels()->get($requestConfiguration)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.teams.item.all_channels.all_channels_request_builder import AllChannelsRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = AllChannelsRequestBuilder.AllChannelsRequestBuilderGetQueryParameters(
filter = "membershipType eq 'shared'",
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.teams.by_team_id('team-id').all_channels.get(request_configuration = request_configuration)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": [
{
"@odata.id": "https://graph.microsoft.com/v1.0/tenants/b3246f44-b4gb-5678-96c6-25b18fa2c910/teams/893075dd-5678-5634-925f-022c42e20265/channels/19:[email protected]",
"id": "19:[email protected]",
"createdDateTime": "2020-05-27T19:22:25.692Z",
"displayName": "Shared channel from Contoso",
"membershipType": "shared",
"tenantId": "b3246f44-b4gb-5678-96c6-25b18fa2c910",
"isArchived": false
}
]
}