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 / saving attachments wit...
Power Automate
Answered

saving attachments with specific extensions

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Good afternoon,

 

We have success fully made a flow that saves attachments sent to a specific address to a specific folder on our network. The only problem is that all attachments are saved, so also bits of the signature and other unwanted files. Ideally we only want to save *.pdf and *.xml files to the folder. I'm guessing it's a setting in the "apply to each" section but after selection any of the dynamic content i'm unable to set the parameters. 

 

 

2023_07_25_162244.png
Categories:
I have the same question (0)
  • Matthy79 Profile Picture
    4,188 Super User 2024 Season 1 on at

    Hello @Anonymous 

     

    you should use filter array and after that you apply to each of this filtered items. You could check the name for „endswith“.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello Matthy,

     

    thanks for your reply. I tried using filter array with varying results.

    When using the filter array in combination with "ends with" I get the following error: 

     

    The execution of template action 'Filter_array' failed: The evaluation of 'query' action 'where' expression '@endswith(item(), '.pdf')' failed: 'The template language function 'endswith' expects its first parameter to be of type string. The provided value is of type 'Object'. Please see https://aka.ms/logicexpressions#endswith for usage details.'.

     

    So I made a new flow (see screenshot 1) with a new filter array "Attachments Name" is equal to file.log (for test purposes).


    The flow doesnt give any errors but it still saves all the files to the folder in stead of just the file.log test file that was given in the filter array.

     

    Any help would be much appreciated.

    screenshot1.png
  • Verified answer
    Matthy79 Profile Picture
    4,188 Super User 2024 Season 1 on at

    Hello @Anonymous 

     

    since item() represents one row for each Attachment you have to tell what property you would like to use. In your case it could be item()['name'] or something like that. You have to read the flow history or hover over your "Attachments Name" dynamic content to see what is really happening there.

     

    About your test flow. If you use a filter array you also have to use the output of this filter array inside the apply to each "Select an output from previous step". Otherwise you will loop through all items again and filter array has no meaning.

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
Haque Profile Picture

Haque 573

#2
Valantis Profile Picture

Valantis 407

#3
11manish Profile Picture

11manish 387

Last 30 days Overall leaderboard