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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Get email - control at...
Power Automate
Unanswered

Get email - control attachment name repeats

(0) ShareShare
ReportReport
Posted on by 10

Hello,

 

I am new to Power automate and am trying to get rid of manual email moving.

I have a good idea but do not seem to get it to work.

I hope one of you experts can help me with this.

 

I am building a flow that collects email from a shared mailfolder (=cloudflow).

Once the email is collected a few checks are applied.

 

Stage one is always succesfull.

Emails from certain senders are selected and undergo a rework to flatten the email.

 

However when criteria 1 is not met I run into trouble.

The idea is that if there is a different sender, then the flow should check the email attachments.

If one of the attachments is an xml file then it should be moved to a folder.

If no XML file is found a next stage is applied which checks for PDF files and so on.

 

However, each email usually contains multiple attachments. and there is where it goes wrong.

When I use the Apply to each "Value" or "Current item" the flow blocks.

 
Value error
InvalidTemplate. Unable to process template language expressions for action 'Condition_-_XML_selector' at line '1' and column '24260': 'The template language function 'endsWith' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#endswith for usage details.'.
 
Current item error 
ExpressionEvaluationFailed. The execution of template action 'Apply_to_each_-_XML_selector' failed: the result of the evaluation of 'foreach' expression '@items('Apply_to_each_-_TXT_forward_selection')' is of type 'Object'. The result must be a valid array.

 

If I use the Apply to  Each "Attachments" the flow processes 1 email multiple times (1 time for each attachment found)

And thus applies the subsequent action for as well yes as no and the email ends up in the wrong place.

 

- I need the flow to check if any of the attachments meets the condition. 

- Then apply the subsequent steps to the email (being if yes, move the email ; if no, check for the next condition)

 

 

Below an example of the multiplication.

This is the result of 1 email being processed.

The email contained multiple attachments

Dirk_Belgium_4-1634653821516.png

 

 

Here the build of the flow

Dirk_Belgium_1-1634653528481.png

Dirk_Belgium_2-1634653665957.png

 

 

 

 

 

Categories:
I have the same question (0)

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard