Graph API to get all messages in a Teams channel only returns a maximum 30 days-worth of messages

Bobby Brockway 0 Reputation points
2025-10-28T15:11:05.6666667+00:00

I'm calling the API ({graph_url}/teams/{team_id}/channels/{channel_id}/messages?$top=50) to get all messages within a specific channel. I pull a page of 50, parse it, then get the next URL from data.@odata.nextLink. I then call that URL and so on. However, I only ever get messages that are up to 30 days old. There are definitely more messages in that channel - I can scroll down in the UI and get messages all the way back to July 2025 so it doesn't feel like a retention policy issue. Am I doing something wrong?

Microsoft Teams | Development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Kha-N 3,260 Reputation points Microsoft External Staff Moderator
    2025-10-29T01:12:42.12+00:00

    Hi @BobbyBrock,

    Welcome to Microsoft Q&A moderator, and thank you very much for reaching out to us.

    Based on your description, you’re using Graph API to pull Teams channel messages but only see those from the last 30 days, and you want to know if this approach is correct.

    Please note that as a Microsoft Q&A moderator, I do not have access to your tenant, and my testing environment is limited. However, I will assist you as much as possible using testing and available documentation.

    In my own testing with the same API call you referenced and based on guidance from this Microsoft Article, I was able to retrieve messages dating back to August, which is more than 30 days. This suggests that your method is correct based on my results.

    User's image

    For alternative solution, you can consider using the Microsoft Teams Export API to retrieve all messages in a Teams channel. This API allows you to programmatically export all user or team messages by specifying a date range.

    User's image

    I hope my recommendation helps you further. If you have any questions or need further clarification, please feel free to reach out on the comment section. I’ll be happy to assist you further.


    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.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.