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

Community site session details

Session Id : X6dW3tX57+BVy+z3dM04S1
Power Automate - Building Flows
Answered

Count attachments on email excluding file type

Like (0) ShareShare
ReportReport
Posted on 24 Jan 2019 21:14:23 by 10

 

 

Is there a way to have the flow condition count the attachments that are NOT of a file type. 

 

Example. 

Shared inbox receives an email with 2 attachments. 

 

example.pdf

0000001.jpg

 

Our company uses an email signature (required by all) that has an image. Exchange/Flow recognizes the image as a jpg attachment. I want the condition to count the number of attachments that are NOT .jpg files. 

 

So in the example above, I'd like to have the condition ignore the jpg and only count 1 as the number of attachments. 

 

 

 

 

So the flow would go. 

Trigger: Email arrives in shared inbox

Get email

Condition: If # of attachments = 1 (excluding .jpg)

yes: save 1 file to sharepoint folder excluding jpg > create link to specific file

No: save files to sharepoint folder excluding jpg > Create link to folder with files

 

I got everything else to work well, but the count.

 

I don't really have any screen shots - couldn't get the condition to ever work right.

 

Any ideas?

  • JMFralick Profile Picture
    10 on 29 Jan 2019 at 21:04:58
    Re: Count attachments on email excluding file type

    Thanks for the reminder! I got locked up in another task with hair on it and forgot to get back in here. Yes, you were very helpful. I'll mark this as solved!

  • spsolutionsgrp Profile Picture
    297 on 29 Jan 2019 at 20:21:30
    Re: Count attachments on email excluding file type

    @JMFralickdid this help solve your issue?

  • spsolutionsgrp Profile Picture
    297 on 25 Jan 2019 at 18:21:44
    Re: Count attachments on email excluding file type

    I also think outside of the last Apply to each you will need to "Get files" to get the ID of the Folder you created. Once you have the ID of the folder you should be able to create your sharing link based on the ID.

     

    I have to step away to get some of my task finished for the day but if you are still stuck I will try to finish the process on my end this weekend.

  • Verified answer
    spsolutionsgrp Profile Picture
    297 on 25 Jan 2019 at 18:06:17
    Re: Count attachments on email excluding file type

    I think you may need to move your condition = 1 outside of the first  Apply to each.  

     

    The first Apply to each would just give you the total number so we know if there is more than one addachment that is not a jpeg.  The second apply to each would loop through again and if it is not a jpeg create the file or folder.   I did not create all the details for creating the file or folder but if that is also not working please let me know and I will keep working it.

    AttachmentsFileorFolder.jpg

     

  • JMFralick Profile Picture
    10 on 25 Jan 2019 at 15:02:51
    Re: Count attachments on email excluding file type

    I can get this to run with 2 attachments and it behaves as expected.  

    sample.xlsx

    image.jpg

     

    However with more than 2

    sample.pdf

    flyer.pdf

    image.jpg

     

    It only seems to update the attachment variable by 1 instead of by 2. My condition after looks at the attachment value. If it is 1 it creates a link directly to that item. If it is 2+ it should create a link to the folder with items. 

     

    Do you see any error in my setup here? Not sure if my second condition is wrong or if the update temp is only running for the 1st attachment it finds that is not jpg.

     

    2019-01-25_0900.png2019-01-25_0901.png

  • JMFralick Profile Picture
    10 on 24 Jan 2019 at 21:44:48
    Re: Count attachments on email excluding file type

    Thanks, I'll give this a try. 

  • spsolutionsgrp Profile Picture
    297 on 24 Jan 2019 at 21:42:16
    Re: Count attachments on email excluding file type

    Here is what I came up with that I think will work for you.

     

    The only thing that you can't see in the image is the Expression for the first set variable. Here it is...

    add(variables('TempNumber'),1)

    CountAttachments.jpg

     

    We have to create two variables because we can not use the "Add" expression to update itself. The TempNumber variable allows us to update the temp and inturn update the Attachments variable.

     

     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete