web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / "Get a Thread Post" ke...
Power Automate
Answered

"Get a Thread Post" keeps adding "Apply to each" to every variable and then errors out on receiving an object.

(0) ShareShare
ReportReport
Posted on by 16

I'm having an odd issue, and I seem to be doing everything right based off of the MS post about Office 365 Groups Mail connector.

 

The issue that I'm having is that when I used "Get a Thread Post" action is that it creates a "Apply to each" for the the conversation id variable, and then creates a second nested "apply to each" to the post id variable. When I then run the flow I get an error on the second "Apply to each" saying:

"The execution of template action 'Apply_to_each_2' failed: the result of the evaluation of 'foreach' expression '@items('Apply_to_each')' is of type 'Object'. The result must be a valid array."

 

This is infuriating on two levels, I'm not adding the apply to each, MS is. And there's only one e-mail in each thread there's not even multiple items to parse. Secondly, MS' own post on the connector does this same flow and there's no issues with it: https://flow.microsoft.com/en-us/blog/use-our-new-office-365-groups-mail-connector/

 

Can someone direct me to what I need to tweak to fix the error on the second "apply to each"?

Categories:
I have the same question (0)
  • VictorIvanidze Profile Picture
    13,081 on at

    Show your flow with the error.

  • SpiritBear Profile Picture
    16 on at

    Sure thing. First image is the snippet of the flow with connectors and code in question. Second screenshot is the error log from running it. My assumption is it's complaining because it wants an array of multiple posts in a thread to parse, and I'm giving it a thread that only has a lone post, and that will be the case every time the flow is run. flow error.pngflow error2.png

  • Verified answer
    VictorIvanidze Profile Picture
    13,081 on at

    It looks like you have to use "Posts" instead of "Current item" in the "Apply to each 2"

  • SpiritBear Profile Picture
    16 on at

    Brilliant. That was it. Thank you kindly 👍

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 711

#2
Vish WR Profile Picture

Vish WR 691

#3
Haque Profile Picture

Haque 525

Last 30 days Overall leaderboard