Microsoft release recently support for channel moderation via Microsoft Graph Teams APIs. This allows administrators to read and apply channel moderation settings programmatically. The feature itself has already been there since a while. However, API support wasn’t available in Microsoft Graph before. In this blog post, I will demonstrate how to use this new functionality and what limitations I faced while testing this new approach.
Benefits of channel moderation
A Microsoft Teams team consists of one or more channels. A channel is the place where chat based communication and content sharing happens. Previously, team members or everyone (including guests) have been able to start a new channel post, which represents channel moderation equals
OFF. Now, team owners are capable of turning channel moderation
ON which allows them to limit the posting of new posts to only moderators, with additional control options. This becomes handy if a channel should only by used for announcements or if only a specific users should be allowed to start posts in a channel.
Read channel moderation settings
Reading channel moderation settings is only possible with a Microsoft Graph beta API. Please, keep in mind that beta APIs are subject to change and its usage in production environments are not recommended! That being said, you can use the already existing
GET channel API to retrieve the channelModerationSettings which is part of the response. This is what the API and the response look like:
Note: During my tests, I wasn’t able to get moderation settings of the General channel! The moderationSettings object was always returned with a value of
Applying channel moderation settings
In case you want to apply channel moderation settings programmatically, you can either update an existing channel or apply the moderation settings while creating a new channel. Note that currently only beta API support is available! The example below shows how to apply moderation settings while creating a new channel:
Channel moderation is a good improvement in Microsoft Teams and opens new scenarios while giving more control to team members. This new API support brings flexibility to administrators and developers.
I hope it helps!
Thanks for reading my blog post.