Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

saving attachments with specific extensions

(0) ShareShare
ReportReport
Posted on by

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. 

 

 

  • Verified answer
    Matthy79 Profile Picture
    4,178 Super User 2024 Season 1 on at
    Re: saving attachments with specific extensions

    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.

  • Community Power Platform Member Profile Picture
    on at
    Re: saving attachments with specific extensions

    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.

  • Matthy79 Profile Picture
    4,178 Super User 2024 Season 1 on at
    Re: saving attachments with specific extensions

    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“.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,635 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow