Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a method to get the body and reply of Teams in a single message. #1511

Open
1 task done
zrx1200s opened this issue Aug 22, 2024 · 1 comment
Open
1 task done
Labels
area: model 📐 Related to the core SDK models

Comments

@zrx1200s
Copy link

zrx1200s commented Aug 22, 2024

Category

  • Domain model extension

Describe the domain model extension

First of all, thanks for providing us with a great library.
What we would like to do is update the body of messages sent to Teams and reply to them.

Due to the current SDK specification, there is no way to retrieve Teams messages by themselves,
First, a list of messages must be retrieved, and then the messages must be filtered to update the body of the message and reply to it.
ex) Getting Chat Message replies

channel = await channel.GetAsync(o => o.Messages);
var chatMessage = channel.Messages.AsRequested().FirstOrDefault();// must be load all messages

// Get the replies
var replies = chatMessage.Replies;

If there are a large number of messages in the channel, the API call will take a large amount of time (even if only one reply is written) because the body of the message cannot be updated or replied to without first reading the entire volume of messages.
Therefore, please implement a model for retrieving messages by themselves, specifying the message ID and reply ID.

We have considered the following method implementations, but you are free to change them if you find a more suitable form or implementation location

// get a message
ITeamChatMessage single_message = PnPContext.Team.Channels.GetByDisplayName("General")
.GetByMessageId("id_of_message");// and load ITeamChannel.Messages

//update message(exists method)
single_message.UpdateAsync();

// get a reply
ITeamChatMessageReply single_reply =  single_message
.GetByReplyId("id_of_reply");// and load ITeamChatMessage.Replies

Model

Model: Team, Team.Channels, Team.Channel.Messages

APIs

Microsoft Graph V1

Get a message in a chat
API: https://graph.microsoft.com/v1.0/teams/{team-id}/channels/<channel-id>/messages/<message-id>

Get reply to a message
API: https://graph.microsoft.com/v1.0/teams/{team-id}/channels/<channel-id>/messages/<message-id>/replies/<reply-id>

Additional Information

Get chatMessage in a channel or chat

@jansenbe
Copy link
Contributor

Please submit a PR for this @zrx1200s , happy to merge it!

@jansenbe jansenbe added the area: model 📐 Related to the core SDK models label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: model 📐 Related to the core SDK models
Projects
None yet
Development

No branches or pull requests

2 participants