Hi @Saad Alladmahi
Thank you for posting your question in the Microsoft Q&A forum.
Based on the information you described, I understand that you are trying to build an internal archiving tool by exporting full Teams chat histories via Microsoft Graph. However, you are hitting roadblocks where pagination stops prematurely (preventing access to older messages) and specific data types like reactions and system events are missing.
After researching your issue, here is some insight into why this is happening and the recommended solution:
-The endpoints you are using (/chats/{id}/messages and /teams/{teamId}/channels/{channelId}/messages) are for interactive use (like a user scrolling through a chat), not for bulk archival.
- Pagination Limits: While these endpoints use server-side paging (providing an
@odata.nextLink), they are subject to strict throttling and performance limits. If you request too much data or go back too far, the API may cut off the pagination to preserve service stability. - Delta Query Limitations: Even if you use delta queries (
/users/{id}/chats/getAllMessages/delta), they typically only retrieve data from the last ~8 months. To get history older than that, you would need a full read first, which brings you back to the pagination issues of the standard endpoints. - Missing Metadata: Standard endpoints focus on the main message body. Reactions, edits, and system events often require specific configurations or properties (like
hostedContents) that aren't consistently returned in standardGETrequests to avoid payload bloat.
For your specific use case (archiving and compliance), Microsoft provides the Teams Export APIs. These are specifically designed to handle bulk data extraction without the limitations you are facing.
- Bulk Export: It supports exporting messages from 1:1 chats, group chats, meetings, and public channels.
- Granular Data: It includes message properties that standard endpoints often miss, such as reactions, attachments, and even deleted messages (accessible for up to 21 days after deletion).
- Performance: It allows for high-throughput access (Microsoft recommends setting
TOPto 250 records per call for optimal performance).
Please note that the Teams Export APIs are protected APIs. They usually require specific licenses (such as Microsoft 365 Compliance) or are subject to metered billing (Model B) through an Azure subscription.
You can find more details in the official documentation here: Export content with the Microsoft Teams Export APIs
I hope this information helps you resolve the issue!
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.