Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs
Hi @Lwali Hidayat
There is currently no comprehensive API support to programmatically delete Microsoft Teams messages in bulk across all scenarios. This behavior is intentional, as it supports compliance, auditing, and data governance requirements.
If your group shares sensitive updates and you’d like messages to be automatically removed after a set period such as one month, the recommended approach is to configure retention policies rather than relying on APIs.
Retention policies in Microsoft Purview give administrators the ability to automatically retain or delete Teams messages based on organizational needs. By setting a policy to delete content after a defined duration, you can ensure that messages are cleaned up in line with your governance requirements.
These are helpful resources which you can refer to:
- Learn about retention for Teams | Microsoft Learn
- Manage retention policies for Microsoft Teams - Microsoft Teams | Microsoft Learn
- Automatically retain or delete content by using retention policies | Microsoft Learn
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.