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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

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.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Users online (2,467)