Skip to main content

Notifications

Community site session details

Community site session details

Session Id : Mwgg+Wm5+FCC9Z8J6eob+1
Power Automate - Building Flows
Answered

Extracting URL from email body text

Like (0) ShareShare
ReportReport
Posted on 19 Apr 2021 16:39:39 by

Hello

I'm trying to set up a flow where when an email is flagged a new task is created in Planner. So far I've managed to set up the flow successfully whereby it pulls all of the email body text (converted from HTML to text) into the description of the task but I'd ideally like it to just be the URL from within the email. 

I've tried following this solution: https://powerusers.microsoft.com/t5/Building-Flows/Extract-URL-from-Email-body/m-p/695681#M94225 but something just isn't working for me. I only have 'Compose' action and not 'Compose - Trim Start' or 'Compose - Replace Chars':

LaurenAddison_1-1618850251685.png

This is my current flow:

LaurenAddison_2-1618850326387.png

Can anyone help me please!?

  • Community Power Platform Member Profile Picture
    on 20 Apr 2021 at 07:47:28
    Re: Extracting URL from email body text

    That works! Thank you so much for your help.

  • Verified answer
    Paulie78 Profile Picture
    8,407 Super User 2025 Season 1 on 19 Apr 2021 at 20:29:20
    Re: Extracting URL from email body text

    Hi @Anonymous ,

     

    Here are the screnshots and expressions:

    2021-04-19_21-27-24.png

    All of these should be after the Html to text action, expressions are:

    startPos...
    indexOf(outputs('Html_to_text')?['body'], 'https://docs.google.com')
    
    endPos...
    indexof(substring(outputs('Html_to_text')?['body'], outputs('startPos')), 'sharing')
    
    URL...
    substring(outputs('Html_to_text')?['body'], outputs('startPos'), add(outputs('endPos'),7))

    All are compose actions. See how you get on.

  • Paulie78 Profile Picture
    8,407 Super User 2025 Season 1 on 19 Apr 2021 at 17:38:43
    Re: Extracting URL from email body text

    Not sure what is going on there, another user just tested pasting it for me and it worked for them. Will do you some screenshots, but can't do it right now. Will post screenshots in about an hour.

  • Community Power Platform Member Profile Picture
    on 19 Apr 2021 at 17:32:26
    Re: Extracting URL from email body text

    This is what I'm doing and still no luck:

    LaurenAddison_0-1618853499726.png

     

  • Paulie78 Profile Picture
    8,407 Super User 2025 Season 1 on 19 Apr 2021 at 17:29:11
    Re: Extracting URL from email body text

    Are you sure you copied the entire code? If you miss one character it will not appear, if it does not work for you I will screenshot it.

  • Community Power Platform Member Profile Picture
    on 19 Apr 2021 at 17:27:29
    Re: Extracting URL from email body text

    Thanks for this! I copied the code and then went to Power Automate, but its just showing me this: 

    LaurenAddison_0-1618853202087.png

     

  • Paulie78 Profile Picture
    8,407 Super User 2025 Season 1 on 19 Apr 2021 at 17:22:12
    Re: Extracting URL from email body text

    ok, try this:

    • Copy the code below to your clipboard.
    • Add a new action in your flow after your "HTML to text" action"
    • Click on my clipboard.
    • Click paste.

    A bit like this:

    2021-04-19_06-56-02.gif

    Except your one is called getURL. Because a couple of the concepts are a little complicated I have separated the actions into different steps, so you can better understand what is going on.

     

    After you paste, you will have a scope which will contain the steps that give you the URL, but these are intended to be chained off the action, HTML to text, so must go after it.

    {"id":"2b75eb54-de4b-4cb5-8ab0-96c4-e6bf1982","brandColor":"#8C3900","connectionReferences":{"shared_conversionservice":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_conversionservice/connections/shared-conversionser-8c945934-2489-4e84-98ab-725c-31760fc1"}}},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"getURL","operationDefinition":{"type":"Scope","actions":{"startPos":{"type":"Compose","inputs":"@indexOf(outputs('Html_to_text')?['body'], 'https://docs.google.com')","runAfter":{}},"endPos":{"type":"Compose","inputs":"@indexof(substring(outputs('Html_to_text')?['body'], outputs('startPos')), 'sharing')","runAfter":{"startPos":["Succeeded"]}},"URL":{"type":"Compose","inputs":"@substring(outputs('Html_to_text')?['body'], outputs('startPos'), add(outputs('endPos'),7))","runAfter":{"endPos":["Succeeded"]}}},"runAfter":{"Html_to_text":["Succeeded"]}}}

    See how you get on.

  • Community Power Platform Member Profile Picture
    on 19 Apr 2021 at 17:16:12
    Re: Extracting URL from email body text

    Yes, that's what I'm trying to extract and yes, please can you help me with this instance.

  • Paulie78 Profile Picture
    8,407 Super User 2025 Season 1 on 19 Apr 2021 at 17:13:43
    Re: Extracting URL from email body text

    Are you trying to grab:

    https://docs.google.com/document/d/1Coy_qI5qUAFlMbh2CLWP73Bs9ecK5vlevhaGBhcITx4/edit?usp=sharing

    Correct? 

    As you are parsing a human written email, this is likely to wrong in future, but I can make you something that will pull that out of the email in this instance?

     

  • Paulie78 Profile Picture
    8,407 Super User 2025 Season 1 on 19 Apr 2021 at 17:08:41
    Re: Extracting URL from email body text

    lol, that is a bit more than I was looking for, but that will do. 😂

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…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,731 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,075 Most Valuable Professional

Leaderboard