cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jcsdias
Frequent Visitor

Get Teams messages and its replies

Hello,

 

I would like to get the last posts in a Teams channel and the replies to each post. How can I do that?

I get the parent posts with "Get Messages", but after that I don't know how to get its replies...

 

Thank you very much for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
duco1745
Regular Visitor

I just finished up doing this exact thing with great success!

 

Myself and a colleague would pass the Team ID and the Channel ID and the Message ID into a flow. Within the flow we used the O365 Groups connector. It has an action that is to send an HTTP request. We used the Graph API within this field. It would look something like this:

duco1745_0-1669921255909.png

We'd then parse the JSON and send the data out. The benefit to this is that it does not require elevated permissions to use the Graph API. I'm not sure how it works but when we run this GET in Graph we get a Forbidden error, but when we do it through this connector we get our replies. Hope this helps!!!

View solution in original post

6 REPLIES 6
SudeepGhatakNZ
Resident Rockstar
Resident Rockstar

You could try the GRAPH API.

Get Replies to Teams Thread in Power Automate with Graph API | Magnetism Solutions | NZ (Auckland, W...

If my suggestion helped you, please give it a Thumbs up and mark it as a Solution so that it can benefit others in the community.
jcsdias
Frequent Visitor

Hi @SudeepGhatakNZ .

 

Thank you for your reply. In my company we don't have authorization to use the Graph API. Do you know any other option to do this?

 

Thank you.

SudeepGhatakNZ
Resident Rockstar
Resident Rockstar

I am sorry, not using flow.

You could try the PnP libraries using JS

message reply list - CLI for Microsoft 365 (pnp.github.io)

If my suggestion helped you, please give it a Thumbs up and mark it as a Solution so that it can benefit others in the community.
jcsdias
Frequent Visitor

Also, I can't use external libraries (I can't make the necessary authentication).

duco1745
Regular Visitor

I just finished up doing this exact thing with great success!

 

Myself and a colleague would pass the Team ID and the Channel ID and the Message ID into a flow. Within the flow we used the O365 Groups connector. It has an action that is to send an HTTP request. We used the Graph API within this field. It would look something like this:

duco1745_0-1669921255909.png

We'd then parse the JSON and send the data out. The benefit to this is that it does not require elevated permissions to use the Graph API. I'm not sure how it works but when we run this GET in Graph we get a Forbidden error, but when we do it through this connector we get our replies. Hope this helps!!!

Thank you very much.

Worked perfectly!!!

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (5,765)