Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
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

Like (0) ShareShare
ReportReport
Posted on 30 Apr 2020 04:46:32 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!!!

 

 

  • r96359 Profile Picture
    228 on 01 May 2020 at 02:38:14
    Re: 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

    @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!

  • v-alzhan-msft Profile Picture
    on 01 May 2020 at 01:14:12
    Re: 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

    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 30 Apr 2020 at 17:30:24
    Re: 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

    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

     

     

     

     

  • Verified answer
    v-alzhan-msft Profile Picture
    on 30 Apr 2020 at 08:50:01
    Re: 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

    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.

  • VictorIvanidze Profile Picture
    12,248 on 30 Apr 2020 at 08:40:53
    Re: 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

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

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 66 Super User 2025 Season 1

#2
stampcoin Profile Picture

stampcoin 65

#3
rzaneti Profile Picture

rzaneti 39 Super User 2025 Season 1

Overall leaderboard
Loading started