List channels
-
- 3 minutes to read
-
Namespace: microsoft.graph
Retrieve the list of channels in this team.
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: 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/{id}/channels
Optional query parameters
This method supports the $filter, $select, and $expand 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/{id}/channels
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var channels = await graphClient.Teams["{id}"].Channels
.Request()
.GetAsync();
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/teams/{id}/channels"]]];
[urlRequest setHTTPMethod:@"GET"];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
NSError *jsonError = nil;
MSCollection *collection = [[MSCollection alloc] initWithData:data error:&jsonError];
MSGraphChannel *channel = [[MSGraphChannel alloc] initWithDictionary:[[collection value] objectAtIndex: 0] error:&nserror];
}];
[meDataTask execute];
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
IGraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
IChannelCollectionPage channels = graphClient.teams("{id}").channels()
.buildRequest()
.get();
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
Response
The following is the response.
Note: The response object shown here might be shortened for readability. All the properties will be returned from an actual call.
HTTP/1.1 200 OK
Content-type: application/json
Content-length: 262
{
"value": [
{
"description": "description-value",
"displayName": "display-name-value",
"id": "id-value",
"isFavoriteByDefault": false,
"webUrl": "webUrl-value",
"email": "email-value"
}
]
}
Example 2: List all private channels
Request
The following example shows a request to list all private channels.
GET https://graph.microsoft.com/beta/teams/{id}/channels?$filter=membershipType eq 'private'
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var channels = await graphClient.Teams["{id}"].Channels
.Request()
.Filter("membershipType eq 'private'")
.GetAsync();
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
const options = {
authProvider,
};
const client = Client.init(options);
let res = await client.api('/teams/{id}/channels')
.version('beta')
.filter('membershipType eq \'private\'')
.get();
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/teams/{id}/channels?$filter=membershipType%20eq%20'private'"]]];
[urlRequest setHTTPMethod:@"GET"];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
NSError *jsonError = nil;
MSCollection *collection = [[MSCollection alloc] initWithData:data error:&jsonError];
MSGraphChannel *channel = [[MSGraphChannel alloc] initWithDictionary:[[collection value] objectAtIndex: 0] error:&nserror];
}];
[meDataTask execute];
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
IGraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
IChannelCollectionPage channels = graphClient.teams("{id}").channels()
.buildRequest()
.filter("membershipType eq 'private'")
.get();
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
Response
The following is an example of the response.
Note: The response object shown here might be shortened for readability. All the properties will be returned from an actual call.
HTTP/1.1 200 OK
Content-type: application/json
Content-length: 262
{
"value": [
{
"description": "description-value",
"displayName": "display-name-value",
"id": "id-value",
"isFavoriteByDefault": false,
"webUrl": "webUrl-value",
"email": "email-value"
}
]
}