Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs
Hi @Eran Otmi
Based on the current Microsoft Graph and Teams Export API documentation, I'm not aware there is a supported way to achieve the workflow you're describing.
- Based on the current documentation, there is no support for filtering
getAllMessagesbychatId. The API does not exposechatIdas a supported filter property. As a result, there is no supported way today to scopegetAllMessagesto a specific set of chat IDs.
- The documentation for listing chat messages states that, in application context, the request must be made from the tenant that owns the chat. Therefore, for chats that originate in another tenant, an application registered in your tenant would generally not be able to retrieve messages using
GET /chats/{chat-id}/messageseven when the monitored user participates in that conversation. - I am not aware of any Graph endpoint that specifically enumerates chats where a user participates as an external or guest user in another tenant when those chats are not returned.
- Given the current limitations, the practical approach appears to be using
GET /users/{id}/chats/getAllMessagesas the authoritative source for exporting cross-tenant conversations, and then reducing volume through incremental export patterns such aslastModifiedDateTimewatermarking and message-level deduplication. There does not currently appear to be a supported API that allows discovery of those externally owned chats followed by targeted retrieval of their messages.
If this capability is important for your scenario, I'd recommend submitting feedback through the Microsoft Graph feedback channels, as support for filtering by chatId on getAllMessages would significantly improve export efficiency for cross-tenant compliance scenarios.