名前空間: microsoft.graph
重要
Microsoft Graph の /beta バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
指定したチャネルのプロパティを更新 します。
注:
アプリケーションのアクセス許可で使用すると、この API は従量制課金されます。 これは、 model=A 支払いモデルをサポートしています。 詳細については、「 支払いモデル」を参照してください。 クエリで支払いモデルを指定しない場合は、既定の 評価モード が使用されます。
この API は、次の国内クラウド展開で使用できます。
| グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
| ✅ |
✅ |
✅ |
✅ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
この API では、管理者のアクセス許可がサポートされています。 Microsoft Teamsサービス管理者は、メンバーではないチームにアクセスできます。
| アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
| 委任 (職場または学校のアカウント) |
ChannelSettings.ReadWrite.All |
Directory.ReadWrite.All、Group.ReadWrite.All |
| 委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
| アプリケーション |
ChannelSettings.ReadWrite.Group |
ChannelSettings.ReadWrite.All、Directory.ReadWrite.All、Group.ReadWrite.All |
注:
- ChannelSettings.ReadWrite.Group のアクセス許可では 、リソース固有の同意が使用されます。
- Group.ReadWrite.All と Directory.ReadWrite.All とアクセス許可は、下位互換性のためにのみサポートされます。 前の表に記載されている別のアクセス許可を使用するようにソリューションを更新し、今後これらのアクセス許可を使用しないようにすることをお勧めします。
HTTP 要求
PATCH /teams/{team-id}/channels/{channel-id}
| ヘッダー |
値 |
| Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
| Content-Type |
application/json. 必須です。 |
要求本文
要求本文で、チャンネル オブジェクトの JSON 表記を指定します。
メモ: 既存のチャネルの membershipType 値を更新することはできません。
応答
成功した場合、このメソッドは 204 No Content 応答コードを返します。
例
例 1: チャネルを更新する
要求
次の例は要求を示しています。
PATCH https://graph.microsoft.com/beta/teams/893075dd-2487-4122-925f-022c42e20265/channels/19:561fbdbbfca848a484f0a6f00ce9dbbd@thread.tacv2
応答
次の例は応答を示しています。
HTTP/1.1 204 No Content
例 2: モデレーション設定を使用してチャネルを更新する
要求
次の例は、チャネルの モデレート設定 を更新する要求を示しています。 この操作を実行できるのはチームの所有者だけです。
PATCH https://graph.microsoft.com/beta/teams/893075dd-2487-4122-925f-022c42e20265/channels/19:561fbdbbfca848a484f0a6f00ce9dbbd@thread.tacv2
Content-type: application/json
{
"displayName": "UpdateChannelModeration",
"description": "Update channel moderation.",
"moderationSettings": {
"userNewMessageRestriction": "moderators",
"replyRestriction": "everyone",
"allowNewMessageFromBots": true,
"allowNewMessageFromConnectors": true
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Channel
{
DisplayName = "UpdateChannelModeration",
Description = "Update channel moderation.",
ModerationSettings = new ChannelModerationSettings
{
UserNewMessageRestriction = UserNewMessageRestriction.Moderators,
ReplyRestriction = ReplyRestriction.Everyone,
AllowNewMessageFromBots = true,
AllowNewMessageFromConnectors = true,
},
};
// 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}"].PatchAsync(requestBody);
// 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"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewChannel()
displayName := "UpdateChannelModeration"
requestBody.SetDisplayName(&displayName)
description := "Update channel moderation."
requestBody.SetDescription(&description)
moderationSettings := graphmodels.NewChannelModerationSettings()
userNewMessageRestriction := graphmodels.MODERATORS_USERNEWMESSAGERESTRICTION
moderationSettings.SetUserNewMessageRestriction(&userNewMessageRestriction)
replyRestriction := graphmodels.EVERYONE_REPLYRESTRICTION
moderationSettings.SetReplyRestriction(&replyRestriction)
allowNewMessageFromBots := true
moderationSettings.SetAllowNewMessageFromBots(&allowNewMessageFromBots)
allowNewMessageFromConnectors := true
moderationSettings.SetAllowNewMessageFromConnectors(&allowNewMessageFromConnectors)
requestBody.SetModerationSettings(moderationSettings)
// 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").Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Channel channel = new Channel();
channel.setDisplayName("UpdateChannelModeration");
channel.setDescription("Update channel moderation.");
ChannelModerationSettings moderationSettings = new ChannelModerationSettings();
moderationSettings.setUserNewMessageRestriction(UserNewMessageRestriction.Moderators);
moderationSettings.setReplyRestriction(ReplyRestriction.Everyone);
moderationSettings.setAllowNewMessageFromBots(true);
moderationSettings.setAllowNewMessageFromConnectors(true);
channel.setModerationSettings(moderationSettings);
Channel result = graphClient.teams().byTeamId("{team-id}").channels().byChannelId("{channel-id}").patch(channel);
const options = {
authProvider,
};
const client = Client.init(options);
const channel = {
displayName: 'UpdateChannelModeration',
description: 'Update channel moderation.',
moderationSettings: {
userNewMessageRestriction: 'moderators',
replyRestriction: 'everyone',
allowNewMessageFromBots: true,
allowNewMessageFromConnectors: true
}
};
await client.api('/teams/893075dd-2487-4122-925f-022c42e20265/channels/19:561fbdbbfca848a484f0a6f00ce9dbbd@thread.tacv2')
.version('beta')
.update(channel);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Channel;
use Microsoft\Graph\Beta\Generated\Models\ChannelModerationSettings;
use Microsoft\Graph\Beta\Generated\Models\UserNewMessageRestriction;
use Microsoft\Graph\Beta\Generated\Models\ReplyRestriction;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Channel();
$requestBody->setDisplayName('UpdateChannelModeration');
$requestBody->setDescription('Update channel moderation.');
$moderationSettings = new ChannelModerationSettings();
$moderationSettings->setUserNewMessageRestriction(new UserNewMessageRestriction('moderators'));
$moderationSettings->setReplyRestriction(new ReplyRestriction('everyone'));
$moderationSettings->setAllowNewMessageFromBots(true);
$moderationSettings->setAllowNewMessageFromConnectors(true);
$requestBody->setModerationSettings($moderationSettings);
$result = $graphServiceClient->teams()->byTeamId('team-id')->channels()->byChannelId('channel-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Teams
$params = @{
displayName = "UpdateChannelModeration"
description = "Update channel moderation."
moderationSettings = @{
userNewMessageRestriction = "moderators"
replyRestriction = "everyone"
allowNewMessageFromBots = $true
allowNewMessageFromConnectors = $true
}
}
Update-MgBetaTeamChannel -TeamId $teamId -ChannelId $channelId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.channel import Channel
from msgraph_beta.generated.models.channel_moderation_settings import ChannelModerationSettings
from msgraph_beta.generated.models.user_new_message_restriction import UserNewMessageRestriction
from msgraph_beta.generated.models.reply_restriction import ReplyRestriction
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Channel(
display_name = "UpdateChannelModeration",
description = "Update channel moderation.",
moderation_settings = ChannelModerationSettings(
user_new_message_restriction = UserNewMessageRestriction.Moderators,
reply_restriction = ReplyRestriction.Everyone,
allow_new_message_from_bots = True,
allow_new_message_from_connectors = True,
),
)
result = await graph_client.teams.by_team_id('team-id').channels.by_channel_id('channel-id').patch(request_body)
応答
次の例は応答を示しています。
HTTP/1.1 204 No Content
例 4: チャネルのレイアウトの種類を更新する
この例では、既存のチャネルのレイアウトの種類を投稿からチャットに更新する方法を示します。
要求
次の例は、チャネルのレイアウトを従来の返信後の形式からチャットのようなスレッド エクスペリエンスに変更する要求を示しています。
PATCH https://graph.microsoft.com/beta/teams/893075dd-2487-4122-925f-022c42e20265/channels/19:4b6bed8d24574f6a9e436813cb2617d8@thread.tacv2
Content-type: application/json
{
"layoutType": "chat"
}
応答
次の例は応答を示しています。
HTTP/1.1 204 No Content
例 5: チャネルをポスト レイアウトの種類に戻す
この例では、チャット レイアウト チャネルを従来の返信後の形式に変換する方法を示します。
要求
PATCH https://graph.microsoft.com/beta/teams/893075dd-2487-4122-925f-022c42e20265/channels/19:4b6bed8d24574f6a9e436813cb2617d8@thread.tacv2
Content-type: application/json
{
"layoutType": "post"
}
応答
次の例は応答を示しています。
HTTP/1.1 204 No Content
関連コンテンツ
Microsoft Graph サービス固有の調整制限