Controlling settings, permissions, and membership within Teams and channels
To archive Teams channels via Microsoft Power Automate, you cannot directly set the isArchived property to true using a PATCH request as you attempted. Instead, you should use the Microsoft Graph API's specific endpoint for archiving channels, which is a POST request to the following URL:
POST https://graph.microsoft.com/v1.0/teams/{team-id}/channels/{channel-id}/archive
Steps to Automate Channel Archiving:
- Use the Correct HTTP Method: Instead of PATCH, use POST to archive the channel.
- Set the Request Headers: Ensure you include the required
Authorizationheader with a valid Bearer token and setContent-Typetoapplication/json. - Request Body: You can optionally include a JSON object in the request body to set permissions for channel members to read-only on the SharePoint Online site associated with the team. For example:
{ "shouldSetSpoSiteReadOnlyForMembers": true } - Check Permissions: Ensure that the user making the request has the necessary permissions, such as
ChannelSettings.ReadWrite.All. - Handle the Response: If the archiving is successful, you should receive a
202 Acceptedresponse code.
If you continue to face issues, ensure that the channel does not belong to a team that is archived, as channels cannot be archived if their team is archived.
References: