名前空間: microsoft.graph
重要
Microsoft Graph の /beta バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
チャネルのプロパティと関係を取得します。
このメソッドはフェデレーションをサポートします。 チャネル情報を取得できるのは、共有チャネルのメンバーであるユーザーのみです。
この API は、次の国内クラウド展開で使用できます。
| グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
| ✅ |
✅ |
✅ |
✅ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
この API では、管理者のアクセス許可がサポートされています。 グローバル管理者またはMicrosoft Teams サービス管理者ロールを持つユーザーは、メンバーではないチームにアクセスできます。
| アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
| 委任 (職場または学校のアカウント) |
Channel.ReadBasic.All |
ChannelSettings.ReadWrite.All、ChannelSettings.Read.All、Directory.Read.All、Directory.ReadWrite.All、Group.Read.All、Group.ReadWrite.All |
| 委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
| アプリケーション |
ChannelSettings.Read.Group |
ChannelSettings.ReadWrite.Group、Channel.ReadBasic.All、ChannelSettings.Read.All、ChannelSettings.ReadWrite.All、Directory.Read.All、Directory.ReadWrite.All、Group.Read.All、Group.ReadWrite.All |
注:
- ChannelSettings.Read.Group および ChannelSettings.ReadWrite.Group のアクセス許可では 、リソース固有の同意が使用されます。
- Group.Read.All、Group.ReadWrite.All、Directory.Read.All、Directory.ReadWrite.All の各アクセス許可は、下位互換性のためにのみサポートされます。 前の表に記載されている別のアクセス許可を使用するようにソリューションを更新し、今後これらのアクセス許可を使用しないようにすることをお勧めします。
HTTP 要求
GET /teams/{team-id}/channels/{channel-id}
オプションのクエリ パラメーター
このメソッドは、応答をカスタマイズするための $filter および $selectOData クエリ パラメーターをサポートします。
メモ: summary プロパティは、このトピックの例 2 に示すように、 select パラメーターを使用してのみ取得できます。
| ヘッダー |
値 |
| Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
要求本文
このメソッドには、要求本文を指定しません。
応答
成功した場合、このメソッドは 200 OK 応答コードと、応答本文で channel オブジェクトを返します。
例
例 1: チャネルを取得する
要求
次の例は要求を示しています。
GET https://graph.microsoft.com/beta/teams/893075dd-2487-4122-925f-022c42e20265/channels/19:561fbdbbfca848a484f0a6f00ce9dbbd@thread.tacv2
// 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}"].GetAsync();
// 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
channels, err := graphClient.Teams().ByTeamId("team-id").Channels().ByChannelId("channel-id").Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Channel result = graphClient.teams().byTeamId("{team-id}").channels().byChannelId("{channel-id}").get();
const options = {
authProvider,
};
const client = Client.init(options);
let channel = await client.api('/teams/893075dd-2487-4122-925f-022c42e20265/channels/19:561fbdbbfca848a484f0a6f00ce9dbbd@thread.tacv2')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->teams()->byTeamId('team-id')->channels()->byChannelId('channel-id')->get()->wait();
Import-Module Microsoft.Graph.Beta.Teams
Get-MgBetaTeamChannel -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').get()
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"id": "19:561fbdbbfca848a484f0a6f00ce9dbbd@thread.tacv2",
"createdDateTime": "2020-05-27T19:22:25.692Z",
"displayName": "General",
"description": "AutoTestTeam_20210311_150740.2550_fim3udfdjen9",
"membershipType": "standard",
"layoutType": "post"
}
次の例は、チャネル モデレーションがオフになっている標準チャネルの応答を示しています。
HTTP/1.1 200 OK
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#teams('8bb12236-b929-42e0-94a0-1c417466ebf8')/channels/$entity",
"id": "19:d468258bc90f4a358361b5d73b89d39b@thread.skype",
"displayName": "TestChannelModeration",
"description": "Test channel moderation.",
"isFavoriteByDefault": null,
"email": "",
"webUrl": "https://teams.microsoft.com/l/channel/19%3Ad468258bc90f4a358361b5d73b89d39b%40thread.skype/General?groupId=8bb12236-b929-42e0-94a0-1c417466ebf8&tenantId=139d16b4-7223-43ad-b9a8-674ba63c7924",
"membershipType": "standard",
"layoutType": "chat",
"isArchived": false,
"moderationSettings": {
"userNewMessageRestriction": "everyone",
"replyRestriction": "everyone",
"allowNewMessageFromBots": true,
"allowNewMessageFromConnectors": true
}
}
次の例は、チャネル モデレートがオンの標準チャネルの応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#teams('8bb12236-b929-42e0-94a0-1c417466ebf8')/channels/$entity",
"id": "19:d468258bc90f4a358361b5d73b89d39b@thread.skype",
"displayName": "TestChannelModeration",
"description": "Test channel moderation.",
"isFavoriteByDefault": null,
"email": "",
"webUrl": "https://teams.microsoft.com/l/channel/19%3Ad468258bc90f4a358361b5d73b89d39b%40thread.skype/General?groupId=8bb12236-b929-42e0-94a0-1c417466ebf8&tenantId=139d16b4-7223-43ad-b9a8-674ba63c7924",
"membershipType": "standard",
"isArchived": false,
"moderationSettings": {
"userNewMessageRestriction": "moderators",
"replyRestriction": "everyone",
"allowNewMessageFromBots": true,
"allowNewMessageFromConnectors": true
}
}
次の例は、プライベート チャネルの応答を示しています。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#teams('8bb12236-b929-42e0-94a0-1c417466ebf8')/channels/$entity",
"id": "19:d468258bc90f4a358361b5d73b89d39b@thread.skype",
"displayName": "TestChannelModeration",
"description": "Test channel moderation.",
"isFavoriteByDefault": null,
"email": "",
"webUrl": "https://teams.microsoft.com/l/channel/19%3Ad468258bc90f4a358361b5d73b89d39b%40thread.skype/General?groupId=8bb12236-b929-42e0-94a0-1c417466ebf8&tenantId=139d16b4-7223-43ad-b9a8-674ba63c7924",
"membershipType": "private",
"isArchived": false,
"moderationSettings": null
}
例 2: channelSummary プロパティを取得する
要求
次の例は、 channelSummary プロパティを取得する要求を示しています。
GET https://graph.microsoft.com/beta/teams/893075dd-2487-4122-925f-022c42e20265/channels/19:561fbdbbfca848a484f0a6f00ce9dbbd@thread.tacv2?$select=summary
// 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}"].GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Select = new string []{ "summary" };
});
// 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
)
requestParameters := &graphteams.ItemChannelsItemRequestBuilderGetQueryParameters{
Select: [] string {"summary"},
}
configuration := &graphteams.ItemChannelsItemRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
channels, err := graphClient.Teams().ByTeamId("team-id").Channels().ByChannelId("channel-id").Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Channel result = graphClient.teams().byTeamId("{team-id}").channels().byChannelId("{channel-id}").get(requestConfiguration -> {
requestConfiguration.queryParameters.select = new String []{"summary"};
});
const options = {
authProvider,
};
const client = Client.init(options);
let channel = await client.api('/teams/893075dd-2487-4122-925f-022c42e20265/channels/19:561fbdbbfca848a484f0a6f00ce9dbbd@thread.tacv2')
.version('beta')
.select('summary')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Teams\Item\Channels\Item\ChannelItemRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new ChannelItemRequestBuilderGetRequestConfiguration();
$queryParameters = ChannelItemRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->select = ["summary"];
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->teams()->byTeamId('team-id')->channels()->byChannelId('channel-id')->get($requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Teams
Get-MgBetaTeamChannel -TeamId $teamId -ChannelId $channelId -Property "summary"
# 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.channel_item_request_builder import ChannelItemRequestBuilder
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 = ChannelItemRequestBuilder.ChannelItemRequestBuilderGetQueryParameters(
select = ["summary"],
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.teams.by_team_id('team-id').channels.by_channel_id('channel-id').get(request_configuration = request_configuration)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#teams('8bb12236-b929-42e0-94a0-1c417466ebf8')/channels(summary)/$entity",
"summary":{
"hasMembersFromOtherTenants":false,
"guestsCount":1,
"membersCount":3,
"ownersCount":2
}
}
例 3: 移行モードでチャネルを取得する
次の例は、移行モードでチャネルを取得する方法を示しています。
要求
次の例は要求を示しています。
GET https://graph.microsoft.com/beta/teams/893075dd-2487-4122-925f-022c42e20265/channels/19:561fbdbbfca848a484f0a6f00ce9dbbd@thread.tacv2
// 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}"].GetAsync();
// 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
channels, err := graphClient.Teams().ByTeamId("team-id").Channels().ByChannelId("channel-id").Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Channel result = graphClient.teams().byTeamId("{team-id}").channels().byChannelId("{channel-id}").get();
const options = {
authProvider,
};
const client = Client.init(options);
let channel = await client.api('/teams/893075dd-2487-4122-925f-022c42e20265/channels/19:561fbdbbfca848a484f0a6f00ce9dbbd@thread.tacv2')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->teams()->byTeamId('team-id')->channels()->byChannelId('channel-id')->get()->wait();
Import-Module Microsoft.Graph.Beta.Teams
Get-MgBetaTeamChannel -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').get()
応答
次の例は、チャネルが移行モードの場合の応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#teams('8bb12236-b929-42e0-94a0-1c417466ebf8')/channels/$entity",
"id": "19:d468258bc90f4a358361b5d73b89d39b@thread.skype",
"displayName": "TestChannelModeration",
"description": "Test channel moderation.",
"isFavoriteByDefault": null,
"email": "",
"webUrl": "https://teams.microsoft.com/l/channel/19%3Ad468258bc90f4a358361b5d73b89d39b%40thread.skype/General?groupId=8bb12236-b929-42e0-94a0-1c417466ebf8&tenantId=139d16b4-7223-43ad-b9a8-674ba63c7924",
"membershipType": "private",
"isArchived": false,
"moderationSettings": null,
"createdDateTime": "2020-05-27T19:22:25.692Z",
"migrationMode": "InProgress",
"originalCreatedDateTime": "2020-05-28T10:00:00+00:00"
}
関連コンテンツ
Microsoft Graph サービス固有の調整制限