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

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

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"?

1 ACCEPTED SOLUTION

Accepted Solutions
VictorIvanidze
Community Champion
Community Champion

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

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

View solution in original post

4 REPLIES 4
VictorIvanidze
Community Champion
Community Champion

Show your flow with the error.

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

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

VictorIvanidze
Community Champion
Community Champion

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

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

Brilliant. That was it. Thank you kindly 👍

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,385)