Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs
Hi @Jason Perrone
For GET /teams/{team-id}/channels/getAllMessages, ordering is not guaranteed.
According to the note in Export content with the Microsoft Teams Export APIs - Microsoft Teams | Microsoft Learn, the order of messages in the response isn't guaranteed to be sorted by any datetime, such as createdDateTime or lastModifiedDateTime.
So even though in testing (and in your observation) results may appear in descending order by createdDateTime, this is not a contractual behavior and should not be relied upon.
This endpoint does not support $orderby. Only a limited set of query options such as $filter are supported for the export APIs, and $orderby is not one of them.
If your scenario depends on ordering, you should:
-Treat the response as unordered
-Apply client-side sorting (e.g., by createdDateTime or lastModifiedDateTime)
-Avoid relying on ordering across pages or repeated calls
-Also note that when filtering on lastModifiedDateTime, edited messages can appear outside their original creation order, which can affect paging results.
I hope this information is helpful.
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.