Share via

Microsoft GRAPH API not returning all messages in teams channel.

Anonymous
2024-01-08T14:38:58.26+00:00

Hi,

I'm using "/beta/teams/{group-id-for-teams}/channels/{channel-id}/messages" (also tried /v1.0/teams/...) to get all messages of the channel of my team. I'm aware of the @odata.nextLink field, but even after using it many times until it disappears, the response does not contain every message in the channel. (I've also tried using $top=20 parameter, but the response was the same.)

I get the most recent message in the channel and also a lot of messages of systemEventMessage type.

For authentication, I've tried both ways - application and using delegated user.

The permissions set up in my application are:

  • Group.Read.All
  • Files.Read.All
  • ChannelMessage.Read.All
Microsoft Teams | Development
Microsoft Teams | Development

Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs

Microsoft Security | Microsoft Graph
Microsoft Teams | Microsoft Teams for business | Other

Locked Question. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

Answer accepted by question author

  1. Md Asif Muztaba 340 Reputation points Microsoft External Staff
    2024-01-11T01:15:29.18+00:00

    In Microsoft Teams, every message in a channel is part of a conversation thread. The first message starts the thread and all subsequent messages are considered replies to that thread. This is by design to keep conversations organized and contextual. When you use the Microsoft Graph API to fetch messages from a channel, the /messages endpoint will only return the first message of each thread in the channel. To get the replies (or subsequent messages) of a thread, you need to use the /replies endpoint on the original message. The @odata.nextLink is provided when the result set exceeds the maximum page size. It’s a URL that you can use to get the next page of results. If you’re seeing a lot of system event messages, it’s because Teams automatically generates these for certain activities (like adding members to a team). I hope this clarifies your question. If you have any more questions, feel free to ask.
    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Was this answer helpful?

    3 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more