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 / Condition to check ema...
Power Automate
Unanswered

Condition to check email subject contains phrase

(0) ShareShare
ReportReport
Posted on by 8

Hello,

 

I am trying to create a power automate flow that checks the subject line for a key phrase and if true it creates a new file in a specific SharePoint folder. The screenshot I attached shows what I tried but it does not work. It returns the value as false and it creates the file in a misc folder. Any help would be greatly appreciated.

 

Thanks.

Categories:
I have the same question (0)
  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at

    @Gonzo2024 You can use the Subject Filter in the When a new email arrives (V3) trigger. The condition action isn't necessary. 

    creativeopinion_0-1708146183565.png

     

    For more flow troubleshooting tips—check out this YT Tutorial: 5 Power Automate Troubleshooting FAQs and Helpful Tips for Creating Better Flows

     

    In this tutorial I cover:

     How to troubleshoot a false Condition action result

     How to get dynamic content when it isn’t selectable from the list of dynamic content

     How to troubleshoot an Apply to Each action that isn’t looping through

     How to troubleshoot a skipped Apply to Each action

     How to troubleshoot a Filter Query

     How to use a SharePoint yes/no column in a Filter Query

     How to use Compose actions to troubleshoot a Power Automate flow

    How to troubleshoot multiple emails being sent

     How to troubleshoot multiple Teams messages being sent

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response! If you're feeling generous— ️  Buy me a coffee: https://www.buymeacoffee.com/acreativeopinion

    👉 Watch my tutorials on YouTube
    👉 Tips and Tricks on TikTok

     

  • Gonzo2024 Profile Picture
    8 on at

    Let me better explain what I want to do. I am setting up a photo inbox for youth sports. When someone submits photos I want them to put grade, gender, and sport in the subject. Based on what is in the subject I want a different action to save the photos to a specific folder in a Sharepoint library. Wouldn't I need to use a condition to do this?

     

    1. email arrives to sharedmailbox

    2. 3rd grade girls lacrosse - subject

    3. Save to to 3rd grade girls lacrosse folder

     

    1. email arrives to shared mailbox

    2. 3rd grade boys basketball

    3. 3rd grade boys basketball fodler.

     

    Thanks.

  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at

    @Gonzo2024 Sorry I misunderstood your original post. Depending on how many folders you need to file your photos in, nesting multiple condition actions inside each other will be inefficient. It would be better to create a folder (if it doesn't exist) or look for a folder if it does and place the photos into that folder.

     

    Are you expecting the subject lines to have consistent syntax? Grade first, gender second and then sport? Are you expecting the grade to be 3rd grade or grade 3? 

     

    The reason I'm asking is that if the subject line comes in as: 3rd grade girls lacrosse - subject, you could split the subject line at the '-'. This would leave you with 3rd grade girls lacrosse. You would use that string to check if the folder exists, if not, create one, if so put the attachments into the folder.

     

    However, if the subject line is Grade 3 girls lacross - subject or Gr. 3 girls lacross - subject  you would have to add extra logic to your flow. 

     

    You might find this YT Tutorial Helpful: Save Email Attachments to SharePoint with Microsoft Power Automate

    Power Automate doesn’t have a download attachment from outlook action. In this Power Automate Video tutorial, I’ll show you how to use the Get Attachment (V2) action in combination with the Create File action to get your email attachments onto SharePoint.

     

    The Create File action will overwrite any files that already exist with the same name. In this tutorial, I’ll show you how you can append a timestamp to the end of a file name to prevent your file from being overwritten. I’ll also show you how to set up your flow so that you can trigger it manually while building it so you don’t need to wait for an email to arrive. At the end of the video I’ll show you how adding trigger conditions to your flow can prevent it from triggering if certain conditions aren’t met.

     

    Although the final flow uses the When a new email arrives in a shared mailbox (V2) trigger, you can use any of the When a new email arrives triggers for your flow. Adjust this flow to suit your needs!

     

    IN THIS VIDEO:

     How to Automate Downloading and Uploading Email Attachments to SharePoint

     How to Use a the Get Email (V2) action

     How to Use the Get Attachment (V2) action

    How to Create Attachment Files using the Create File Action

     How to Prevent the Create File Action from Overwriting a File

     How to use Split the Filename from its Extension

     How to Append a Timestamp to a File Name

     How to use the When a New Email Arrives in a Shared Mailbox (V2) trigger.

     How to use the Convert Time Zone action

    How to add Trigger Conditions to your Flow

     

    Hope this helps!


    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response! If you're feeling generous— ️  Buy me a coffee: https://www.buymeacoffee.com/acreativeopinion

    👉 Watch my tutorials on YouTube
    👉 Tips and Tricks on TikTok
  • VictorIvanidze Profile Picture
    13,073 on at

    Use this freeware as a base: https://ivasoft.com/sortemailsflow.shtml and modify it according your needs.

  • S-Venkadesh Profile Picture
    927 Moderator on at

    Hi @Gonzo2024 

    Here is the solution to meet your requirements. I've tested your use case and attached a screenshot of the flow for your reference.

    Steps:

    1. Trigger: When a new email arrives.
    2. Check if the email has attachments.
    3. If attachments exist, retrieve all attachments.
    4. Loop through each attachment and save it into the target folder based on the subject condition.
      SVenkadesh_0-1708245495512.png

    I hope this information is helpful. If it is, please consider giving a thumbs up 👍.

    Best regards,
    Venkadesh Sundaramurthy

  • Gonzo2024 Profile Picture
    8 on at

    Thanks @S-Venkadesh. going to give this a try. is there a way on the subject line to look for matches that are close but not exact? For instance, I want to check to see if "3rd", "Girls", and "Lacrosse" are at least present in the subject line. Just in case the end user doesn't put it in the exact way we instructed them to.

     

    Thanks.

  • Gonzo2024 Profile Picture
    8 on at

    @S-Venkadesh so the logic you sent is working. However, it is not reading the subject line for the word "lacrosse". Does the word or phrase need to be formatted in a specific way? Does it need quotes around it?

    Screenshot 2024-02-24 at 10.32.18 PM.png

    Thanks.

    Screenshot 2024-02-24 at 10.24.57 PM.png

  • S-Venkadesh Profile Picture
    927 Moderator on at

    Hi @Gonzo2024 ,

    When writing an expression, you should specify plain text without quotes.
    The Flow will automatically add the quotes. You can observe this in the code view.
    Please refer to the screenshots below and ensure that they match yours.

    If your condition in Power Automate is not working, it might be due to upper/lower case mismatches in your string. To troubleshoot, follow these steps:

    1. Go to the run history.
    2. Select the most recent run.
    3. Check the output of the trigger. This will provide insights into how the text appears.



    SVenkadesh_0-1709007309876.pngSVenkadesh_1-1709007332143.png

     

    I hope this information is helpful. If it is, please consider giving a thumbs up 👍.

    Best regards,
    Venkadesh Sundaramurthy

  • Gonzo2024 Profile Picture
    8 on at

    Hello @S-Venkadesh

    Thanks for the reply. I am not getting any detailed logs from the run history. It says that is "succeed". However, when I click on it and review the flow it says that it skips the step of "Get-Attachment". Is there anywhere to get more details about why it was skipped?

     

    Screenshot 2024-02-27 at 2.50.49 PM.png

     

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

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard