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?
Solved! Go to Solution.
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.
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...
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.
Thanks, I'll give this a try.
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.
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.
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.
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!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
29 | |
27 | |
23 | |
17 | |
10 |
User | Count |
---|---|
66 | |
58 | |
29 | |
27 | |
25 |