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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Perform an action base...
Power Automate
Unanswered

Perform an action based on a substring in an email subject

(0) ShareShare
ReportReport
Posted on by 2

I am relatively new to Power Automate. I try to move an incoming email to a specific folder based on a sub string within the email subject. I tried to use the switch function using the contain function (contains(triggerOutputs()?['body/subject'])), but it doesn't work.

 

Any help is appreciated. Thanks

Categories:
I have the same question (0)
  • Sundeep_Malik Profile Picture
    6,484 on at

    Hey @m0w 

    To use contains you will have to match your subject to something. So, you can keep your folder names in a compose, in an array of string. For example: 

    A, B and C are your folders, then in the compose write ["A","B","C"]

    Then store the subject of the current email in a compose.

     

    Sundeep_Malik_0-1663235399381.png

     

     

    After this use an apply to each, and give the output of folder's compose in the option field of apply to each. Inside this use a condition action. In the condition use 

    contains(triggerOutputs()?['body/subject'],items('Apply_to_each'))
    and match it to true. When this does, save the mail to the required folder. 

     

    Sundeep_Malik_1-1663235513213.png

    I hope this helps. 

  • m0w Profile Picture
    2 on at

    Thank you, i think I understand it, but i think this doesn't apply to my case.

    The folder names are different from the sub strings in the subject line that i am looking for.

     

    e.g., if the subject contains 'GP', move the email in folder Inbox/XX/YY. If the subject contains 'QY', move the email to folder inbox/XX/ZZ.

     

    All this in parallel to save the attachment on sharepoint, so i start using a  'When a new email arrives in a shared mailbox (V2)

    But that part works well for me

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 77 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 68

#3
Expiscornovus Profile Picture

Expiscornovus 56 Most Valuable Professional

Last 30 days Overall leaderboard