Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs
Hello Eran Otmi,
Deleted voice messages (audio clips recorded in Teams chat) are handled differently than regular attachments when using the Graph API.
Here's what's happening:
/getAllMessages and /getAllRetainedMessages will return metadata for deleted voice messages, but the hosted content URL for the audio file will either be empty or return a 404 after deletion. In contrast, regular attachments like images, GIFs, or files are stored in SharePoint or OneDrive and remain accessible even after the chat message is soft-deleted. Voice messages are stored in Teams' internal storage, so when deleted, the audio data is removed and not retained like other attachments.
Alternative approaches:
-Microsoft Purview eDiscovery: Run a content search scoped to Teams messages. Purview may retain references to voice messages if a retention or legal hold policy was active before deletion.
- Compliance Export via Purview: Export Teams chat data, which may include voice message files if covered by retention.
- Teams Export API with resource-specific consent: Apps with RSC permissions can access chatMessage resources with hostedContents, but post-deletion availability depends on retention.
- Proactive archival: If you need to preserve voice messages, capture them in real-time through subscription/webhook notifications (/chats/getAllMessages) before deletion occurs.
Recommendation: For regulatory compliance that requires retaining deleted voice messages, set up a Purview retention policy with "Retain items even if users delete" on Teams chat messages, and use eDiscovery for retrieval instead of relying on Graph API endpoints.