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 / When Email Subject con...
Power Automate
Answered

When Email Subject contains a keyword (one of 25), then store a string variable that can be used to define folder of same name to store attachments

(0) ShareShare
ReportReport
Posted on by 228

Pulling my hair out trying to figure this one out.

I have emails coming in that I need to store attachments to specific folders if the subject of the email matches a keyword.

 

Process:

1. Look for specific keywords in Subject of email using contains.

2. If a keyword is a match (25 different possible keywords), then store that keyword as a variable

3. Use the variable to define the directory path the attachment will be saved in. (I have 25 different folders)

 

Example:

1. If Subject of email contains keyword 'RB75'

2. Save variable value as 'RB75' 

3. Use variable value to define path to store attachments i.e. C:\RB75\

 

I'm new to Power Automate and having a hard time figuring out how to create a array to look for contains keyword in the Subject then store that as a variable that I can use later.

 

Any help would be greatly appreciated!!!

 

 

Categories:
I have the same question (0)
  • VictorIvanidze Profile Picture
    13,073 on at

    Hi @r96359, did you see this: https://docs.microsoft.com/ru-ru/power-automate/data-operations ?

  • Verified answer
    v-alzhan-msft Profile Picture
    on at

    Hi @r96359 ,

     

    You could refer to screenshot below to create the flow:

    2.png

    1.png

     

    You could save the attachment to your sharepoint library or local path refer to the example screenshot.

     

     

    Best Regards,

    Alice

     

    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • r96359 Profile Picture
    228 on at

    Thank you both @VictorIvanidze and @v-alzhan-msft .

    Trying to build upon this and also make the keywords easier to maintain, I created a excel file with a table called CC in SharePoint.

    I think I am close.

    I then used a filter array so I could use contains from the subject heading and find a match.

    The output upon testing shows the result is "CompanyCodes":  "US63" . This is a match and a single result returned.

    When trying to use the result as an output, the expression conc() seems to not see the filter array object. I have tried several ways and it seems to only work with strings. 

     

    Any suggestions on how to fix this last step?

    Images below.

     

    Many Thanks!!

     

    help1.pnghelp2.pnghelp3.png

     

     

     

     

  • v-alzhan-msft Profile Picture
    on at

    Hi @r96359 ,

     

    Don't know the details of the concat() expression in your flow, and you could refer to the screenshot below to create the flow:

    1.png

     

    Best Regards,

    Alice

     

    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • r96359 Profile Picture
    228 on at

    @v-alzhan-msft this idea moved me into creating a table in excel using filter array.

    I then use the expression  first(body('Filter_array'))?['CompanyCodes'] to assign the value as a directory path.

     

    Many thanks!

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 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard