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 / Filing attachments in ...
Power Automate
Unanswered

Filing attachments in Document Library based on name using Office 365 Group Mail Connector

(0) ShareShare
ReportReport
Posted on by 17

We are trying to build a flow using the Office 365 Group Mail connector as described here: Use our new Office 365 Groups Mail Connector! | Power Automate Blog (microsoft.com)

 

It works as expected however we would like to have the attachments filed in certain folders based on the name. For instance, if the attachment name had FLA in the first 3 characters, it would file it in the FLA folder. If the attachment didn't match any defined pattern/expression, it would file it in a "catch-all" folder we specify. 

 

Is this possible with this connector? I know it is not GA yet. 

 

Categories:
I have the same question (0)
  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    Hello @ccalaf ,

     

    It is possible that you check the name of attachment and based on that put conditions to create the folder, in the post that you have linked, there is Apply to Each  action under which there is Create file action to save attachments to SharePoint, just before this Create file action, you can put condition to check name of attachment and under Yes and No branches of condition, you can create the folder and put the create file action under it.

     

    Let me know if you anything is unclear or you need more details.

  • ccalaf Profile Picture
    17 on at

    I appreciate the help. Yes, using an additional condition does work but how do you recommend handling multiple conditions? We expect to have multiple folders so would need to account for multiple file names?  

  • Verified answer
    annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    There are two options one is you can write multiple condition actions and if you dont want to use multiple condition actions, you can use set variable, and expression in set variable like below, which checks if FileName starts with FLA then variable value will be "FLA" otherwise variable value will be "NoFLA"

     

    if(startsWith(variables('FileName'),'FLA'),'FLA','NOFLA')

     

    This way you can use multiple set variables and use same variable across  all set variable actions. Then use switch action and use that variable in switch action with different cases of value you want to check. Let me know if its unclear, example screenshots of flow added below:

    Check FLA value in filenameCheck FLA value in filenameCheck ABC value in filenameCheck ABC value in filenameSwitch conditionSwitch condition

     

  • ccalaf Profile Picture
    17 on at

    Thanks for the tip. I understand the concept, but I may be applying it incorrectly:

    I initialized the variable before my first loop

    ccalaf_0-1608037034366.png

    and after the last loop, I added the Set Variable section:

    ccalaf_1-1608037920194.png

    But when I test the flow using an attachment that starts with FLA, it does not meet the condition

     

    ccalaf_2-1608037995178.png

     

  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    You also need to set FileName variable using Set Variable action, are you doing that?

  • ccalaf Profile Picture
    17 on at

    Can you explain where I would set this variable? Would it before or after the varConditionResults variable? 

  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    You need to set this variable before the varConditionResults  variable

  • ccalaf Profile Picture
    17 on at

    I am setting the variable "FileName" using the Attachment Name from the previous action. 

    ccalaf_0-1608151635123.png

    But it still fails to match the condition. 

    ccalaf_1-1608151766912.pngccalaf_2-1608151782170.png

    Is there something wrong with my expression for varConditionResults? 

  • ccalaf Profile Picture
    17 on at

    I see what I did. I typed the expression in the value window and not the Expression dialog box. It now works but I think I will need a dynamic variable using substring. I want the variable to be set based on the "startsWith". Is that possible while still using the variable named "FileName"?

  • ccalaf Profile Picture
    17 on at

    I figured it out. I just needed to change the varConditionResults value to the following expression:

     

    substring(variables('FileName'),0,3)

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