Namespace: microsoft.graph
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Get a list of all members in a channel. It supports all types of channels. In the case of shared channels, it includes all cross-tenant and cross-team members in a channel.
Note
The membership IDs returned by the server must be treated as opaque strings. Users shouldn't try to parse or make any assumptions about these resource IDs.
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) |
ChannelMember.Read.All |
ChannelMember.ReadWrite.All |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
ChannelMember.Read.Group |
ChannelMember.Read.All, ChannelMember.ReadWrite.All |
Note
The ChannelMember.Read.Group
and ChannelMember.ReadWrite.Group
permissions use resource-specific consent. Currently, these permissions don't work for shared channels.
HTTP request
GET /teams/{team-id}/channels/{channel-id}/allMembers
Optional query parameters
This method supports the $filter
and $select
OData query parameters to help customize the response.
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 conversationMember objects in the response body.
Examples
Example 1: List all members of a channel
The following example shows how to get a list of all members in a channel.
Request
The following example shows a request.
GET https://graph.microsoft.com/beta/teams/2ab9c796-2902-45f8-b712-7c5a63cf41c4/channels/19%3A20bc1df46b1148e9b22539b83bc66809%40thread.skype/allMembers
// 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}"].Channels["{channel-id}"].AllMembers.GetAsync();
mgc-beta teams channels all-members list --team-id {team-id} --channel-id {channel-id}
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
allMembers, err := graphClient.Teams().ByTeamId("team-id").Channels().ByChannelId("channel-id").AllMembers().Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
ConversationMemberCollectionResponse result = graphClient.teams().byTeamId("{team-id}").channels().byChannelId("{channel-id}").allMembers().get();
const options = {
authProvider,
};
const client = Client.init(options);
let allMembers = await client.api('/teams/2ab9c796-2902-45f8-b712-7c5a63cf41c4/channels/19:[email protected]/allMembers')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->teams()->byTeamId('team-id')->channels()->byChannelId('channel-id')->allMembers()->get()->wait();
Import-Module Microsoft.Graph.Beta.Teams
Get-MgBetaTeamChannelMember -TeamId $teamId -ChannelId $channelId
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta 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').channels.by_channel_id('channel-id').all_members.get()
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
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#teams('2ab9c796-2902-45f8-b712-7c5a63cf41c4')/channels('19%3A20bc1df46b1148e9b22539b83bc66809%40thread.skype')/allMembers",
"@odata.count": 2,
"value": [
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"id": "MmFiOWM3OTYtMjkwMi00NWY4LWI3MTItN2M1YTYzY2Y0MWM0IyNlZWY5Y2IzNi0wNmRlLTQ2OWItODdjZC03MGY0Y2JlMzJkMTQ=",
"roles": [
"Member"
],
"displayName": "Caleb Foster",
"userId": "eef9cb36-06de-469b-87cd-70f4cbe32d14",
"email": "[email protected]",
"tenantId": "ar8133445-c7e2-418a-8803-0e68d4b88607"
},
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"id": "MmFiOWM3OTYtMjkwMi00NWY4LWI3MTItN2M1YTYzY2Y0MWM0IyNiMzI0NmY0NC1jMDkxLTQ2MjctOTZjNi0yNWIxOGZhMmM5MTA=",
"roles": [
"Owner"
],
"displayName": "Eric Solomon",
"userId": "b3246f44-c091-4627-96c6-25b18fa2c910",
"email": "[email protected]",
"tenantId": "df81db53-c7e2-418a-8803-0e68d4b88607"
}
]
}
Example 2: Find a channel member using their Microsoft Entra user object ID
The following example shows how to use the $filter
query parameter to get a specific member of a channel using their Microsoft Entra user ID. This filter is applied on the userId property of the aadUserConversationMember resource.
Request
The following example shows a request.
GET https://graph.microsoft.com/beta/teams/ee0f5ae2-8bc6-4ae5-8466-7daeebbfa062/channels/19%3A20bc1df46b1148e9b22539b83bc66809%40thread.skype/allMembers?$filter=(microsoft.graph.aadUserConversationMember/userId eq '73761f06-2ac9-469c-9f10-279a8cc267f9')
// 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}"].Channels["{channel-id}"].AllMembers.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Filter = "(microsoft.graph.aadUserConversationMember/userId eq '73761f06-2ac9-469c-9f10-279a8cc267f9')";
});
mgc-beta teams channels all-members list --team-id {team-id} --channel-id {channel-id} --filter "(microsoft.graph.aadUserConversationMember/userId eq '73761f06-2ac9-469c-9f10-279a8cc267f9')"
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphteams "github.com/microsoftgraph/msgraph-beta-sdk-go/teams"
//other-imports
)
requestFilter := "(microsoft.graph.aadUserConversationMember/userId eq '73761f06-2ac9-469c-9f10-279a8cc267f9')"
requestParameters := &graphteams.ItemChannelsItemAllMembersRequestBuilderGetQueryParameters{
Filter: &requestFilter,
}
configuration := &graphteams.ItemChannelsItemAllMembersRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
allMembers, err := graphClient.Teams().ByTeamId("team-id").Channels().ByChannelId("channel-id").AllMembers().Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
ConversationMemberCollectionResponse result = graphClient.teams().byTeamId("{team-id}").channels().byChannelId("{channel-id}").allMembers().get(requestConfiguration -> {
requestConfiguration.queryParameters.filter = "(microsoft.graph.aadUserConversationMember/userId eq '73761f06-2ac9-469c-9f10-279a8cc267f9')";
});
const options = {
authProvider,
};
const client = Client.init(options);
let allMembers = await client.api('/teams/ee0f5ae2-8bc6-4ae5-8466-7daeebbfa062/channels/19:[email protected]/allMembers')
.version('beta')
.filter('(microsoft.graph.aadUserConversationMember/userId eq \'73761f06-2ac9-469c-9f10-279a8cc267f9\')')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Teams\Item\Channels\Item\AllMembers\AllMembersRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new AllMembersRequestBuilderGetRequestConfiguration();
$queryParameters = AllMembersRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->filter = "(microsoft.graph.aadUserConversationMember/userId eq '73761f06-2ac9-469c-9f10-279a8cc267f9')";
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->teams()->byTeamId('team-id')->channels()->byChannelId('channel-id')->allMembers()->get($requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Teams
Get-MgBetaTeamChannelMember -TeamId $teamId -ChannelId $channelId -Filter "(microsoft.graph.aadUserConversationMember/userId eq '73761f06-2ac9-469c-9f10-279a8cc267f9')"
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.teams.item.channels.item.all_members.all_members_request_builder import AllMembersRequestBuilder
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 = AllMembersRequestBuilder.AllMembersRequestBuilderGetQueryParameters(
filter = "(microsoft.graph.aadUserConversationMember/userId eq '73761f06-2ac9-469c-9f10-279a8cc267f9')",
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.teams.by_team_id('team-id').channels.by_channel_id('channel-id').all_members.get(request_configuration = request_configuration)
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
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#teams('2ab9c796-2902-45f8-b712-7c5a63cf41c4')/channels('19%3A20bc1df46b1148e9b22539b83bc66809%40thread.skype')/allMembers",
"@odata.count": 1,
"value": [
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"id": "ZWUwZjVhZTItOGJjNi00YWU1LTg0NjYtN2RhZWViYmZhMDYyIyM3Mzc2MWYwNi0yYWM5LTQ2OWMtOWYxMC0yNzlhOGNjMjY3Zjk=",
"roles": [],
"displayName": "Adele Vance",
"userId": "73761f06-2ac9-469c-9f10-279a8cc267f9",
"email": "[email protected]"
}
]
}
Related content
List the members of a team.