Microsoft Teams - Channel Clean Up Question

Copper Contributor

Hello, 

 

I am looking to set up a function where a channel can be cleaned up on a scheduled basis. Is there a way to do this?

6 Replies
What do you mean by ‘cleaned up’?

Messages before x date deleted?
Thanks for the response. To give a little background, I manage a team of merchandisers who post pictures daily of their work. I want the channels to be cleared automatically on a weekly basis to reduce clutter
Theres nothing built in to archive this. Although you can build a custom flow with power automate and graph.

Adam
Set up a retention policy to delete messages after a period of time. I know you can definitely do it for 30 days and they planned to bring it down to 1 day but am unsure whether 1 day has been added at the current time

https://docs.microsoft.com/en-us/microsoftteams/retention-policies

Hope that answers your question!

Best, Chris
As Chris said but it applies to a whole team not just a channel. Adams approach cannot work because there is no delete message flow action nor a graph api call for delete. Only add.

So basically you can not achieve this automatically unless your whole team can have a retention policy applied and that is acceptable.

Ps. Pretty sure up to 1 day deletion is live now.
True, saw there still wasn’t any delete channel in graph :\ although retention is might be enough, you keep the channels. You could also use power automate to call Azure Automation to run a powershell script to delete channels. Or just run the script manually or scheduled. Although you need to figure how to make it delete the channels you want.
Also, an important note here! If the Team is older than about 1,5 years or so there is a hard limit of 200 channels that even includes deleted ones..

I do vote for retention though. It’s easier to keep the channels and maybe just restructure the way you work today!

Retention for Teams:

https://techcommunity.microsoft.com/t5/microsoft-teams-blog/retention-policies-for-microsoft-teams/b...

Example of running PowerShell scripts via Power Automate and Azure Automation

https://practical365.com/microsoft-365/how-to-run-powershell-scripts-to-automate-manual-processes-in...

Regards / Adam


Regards Adam