How to get all URLs from emails from Outlook


This time we will explain how to get all URLS from emails using MS Outlook. Sometimes we need get all URLs from emails. In this post, we will show how to do this. Step by step using SSIS.

Microsoft Graph API is a unified way to access many Microsoft services API including Office 365 API


Before we perform steps listed in this article, you will need to make sure following prerequisites are met:

  1. SSIS designer installed. Sometimes it is referred as BIDS or SSDT (download it from Microsoft site).
  2. Basic knowledge of SSIS package development using Microsoft SQL Server Integration Services.
  3. Make sure ZappySys SSIS PowerPack is installed (download it).
  4. Optional (If you want to Deploy and Schedule ) – Deploy and Schedule SSIS Packages

Steps-by-step process to download images from HTML using SSIS

Register Application (OAuth2 App for Graph API)

First, check our article about how to get the OAuth2 connection, click here for the article

Get the information for the body content from the emails

1. Now, Drag and Drop SSIS Data Flow Task from SSIS Toolbox.

Drag and drop Data flow task

2. Double click on the DataFlow task to see the DataFlow designer surface.

3. From the SSIS toolbox drag and drop JSON Source on the dataflow designer surface.

Drag and drop a JSON sourcec

4. Select the OAuth connection you created, then use this URL to get the body content


Filter the body content

Getting the information from the emails

5. Drag and drop the trash destination and save the result in a file with the following configuration. Make sure to check the Overwrite target file if exists.

Add destination and check the overwrite option

Save the body from the emails in a file

Now we have saved the email body in the file, to extract the links we need to go control flow and drag and drop the Regular Expression Parser Task and follow the steps from below section.

Getting all URLs from emails inside a variable

6. The next step is to save the URLs’. We will use the Regular Expression Parser Task for this.
Also, you need to use Regex and here is one example you can use, in this page Regex101 you can check more details about the expressions we are using:

URLs from emails - Create the expression

Getting all URL from the emails

Expression: href="(.*?)"{{*}}

Save the result in a file of the URLs from emails

7. Finally, use the Logging task to save the URLs in a file, use the following configuration

URLs from emails - Configure the logging Task to save on a file

Uncheck all options and select message type as none


If everything is OK, you will be able to download the URLS from your emails. To do that, we read the list from the body of the emails. Then we get the URLs of the emails using expressions. Finally, we store them in a local file.

Posted in SSIS JSON Source (File/REST), SSIS Regex Parser Task and tagged , .