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 / Need to extract the ur...
Power Automate
Unanswered

Need to extract the url from an hyperlink based text from outlook which contains multiple url based hyper link in Power automate desktop

(1) ShareShare
ReportReport
Posted on by 93

Hello Guys,

 

I want to extracts the hyperlink from outlook emails and need to open them on the browser to download the documents. Please assist me as I am unable to find any concreate solution on this.

I have the same question (0)
  • trice602 Profile Picture
    15,402 Super User 2025 Season 2 on at

    Hi @AsheerHasan ,

     

    I've done this several ways, several times.  Here's my most common path:

     

    In this example, I am feeding Power Automate Desktop a couple hundred URLs from Column A and for each "CurrentItem", I am getting the next free row in Excel, then opening up the webpage given in step#7, collecting 3 data points from the website and storing them in a data table, and then writing those values to an Excel sheet.  In theory, this is the same process you will use to click on items you want to download and loop through URLs.

     

    Please mark as a solution and/or give me a thumbs up for replying and offering help!  Always glad to help! Tom 👍🏽

     

    trice602_1-1692051452267.png

     

     

  • Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at

    Hi @AsheerHasan 

     

    One question, does one outlook email has multiple URL present in it ?

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

     

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    It seems like @trice602 has misread your question, as this is related to retrieving URLs from an Outlook email and not an Excel file.

     

    I can see you mentioned several hyperlinks in a single email. I would guess you use a Retrieve email messages from Outlook account action to retrieve your email messages. When you do that, you end up with a list of email messages stored in %RetrievedEmails% variable. 

     

    I would suggest you use a For each loop on that list, so you are working with a single item at a time. You can then use %CurrentItem.Body% to get the body of the email. 

     

    I would then suggest using Parse text with regular expressions to retrieve your URLs from the body. When you enable the "Is regular expression" toggle in the Parse text action, you can retrieve the matching string from your text. And when you disable the "First occurrence only" toggle, you can retrieve all matching strings, if multiple matches are found.

    Agnius_0-1692073471027.png

     

    These will be stored in a variable called %Matches% and you can loop through it with another For each action, use Go to web page on each current URL, and do whatever you need done to download your documents.

     

    A sample flow would look somewhat like this:

    Agnius_1-1692073678420.png

     

     

    However, in order to provide the exact regular expression to get it, I would need to see a sample body of such an email.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • trice602 Profile Picture
    15,402 Super User 2025 Season 2 on at

    Sorry, I misread.  Tom

  • AsheerHasan Profile Picture
    93 on at

    Thanks for your reply Nived. Yes, mail has multiple links.

  • AsheerHasan Profile Picture
    93 on at

    Hi Agnius,

     

    Thanks for your response. Please refer to the below email body for your reference. 

     

     

    Bulletins

    TIB-577

    Discontinuation of the Compact Wired Remote Controller

    number: TIB-577 | size: 180.0 KB

    Application control guide

    E20-124-1

    Application Control Manual for the SMMS-u system

    number: E20-124 | size: 25.0 MB

  • AsheerHasan Profile Picture
    93 on at

    once we go to the web page, page requires to sign-in to download the documents. As all links are external site URLs and it requires to sing-in and then we can see the download button. Please assist me

  • LokeshBysani Profile Picture
    229 Super User 2024 Season 1 on at

    @AsheerHasan  Thank you for sharing additional details. 

    Following @Agnius instructions above I created the flow for your scenario. 

     

    Variables.CreateNewList List=> URLList
    Outlook.Launch Instance=> OutlookInstance
    Outlook.RetrieveEmailMessages.RetrieveEmails Instance: OutlookInstance Account: $'''test.test@test.com''' MailFolder: $'''PAD''' EmailsToRetrieve: Outlook.RetrieveMessagesMode.All MarkAsRead: False Messages=> RetrievedEmails
    LOOP FOREACH CurrentEmail IN RetrievedEmails
     SET mailBody TO CurrentEmail.Body
     Text.ParseText.RegexParse Text: mailBody TextToFind: $'''url=(.*?)&''' StartingPosition: 0 IgnoreCase: False OccurrencePositions=> Positions Matches=> Matches
     LOOP LoopIndex FROM 0 TO Matches.Count - 1 STEP 1
     Scripting.RunJavascript.RunJavascript JavascriptCode: $'''var encodedUrl = \"%Matches[LoopIndex]%\";
    var decodedURL = decodeURIComponent(encodedUrl);
    WScript.Echo(decodedURL);''' ScriptOutput=> DecodedURL
     Text.Replace Text: DecodedURL TextToFind: $'''url=''' IsRegEx: False IgnoreCase: False ReplaceWith: $'''%''%''' ActivateEscapeSequences: False Result=> DecodedURL
     Text.Replace Text: DecodedURL TextToFind: $'''&''' IsRegEx: False IgnoreCase: False ReplaceWith: $'''%''%''' ActivateEscapeSequences: False Result=> DecodedURL
     Variables.AddItemToList Item: DecodedURL List: URLList
     END
    END
    Outlook.Close Instance: OutlookInstance

     You can copy paste the above code in your desktop flow and test it. 

     

    It will read through all the emails and if there are any hyper links then fetch the URL and add that to a list. You can then loop through each URL in list and perform necessary actions.  

  • AsheerHasan Profile Picture
    93 on at

    AsheerHasan_0-1692085332828.png

    Unable to add matches count -1

     

  • LokeshBysani Profile Picture
    229 Super User 2024 Season 1 on at

    %Matches.Count-1%

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard