How to download file from link in outlook

Dear. All

I want to download file from link in email body contents.
This link is file located in server.

You can see that like this

Hi, all

XXXX.ZIP < - it is link.

How can do this?

Please share me any idea.


1 Like

Hi @sungbae.cho

Would accessing your mail body this way achieve your goal?

Thank you for your reply.

Can you give me more information?

Two ways to access the content of your email is:

  • mailMessageVar.Body → if the body is simple text
  • mailMessageVar.Headers(“bodyHTML”) → if the body is HTML

You should see if either prints out anything useful to the output panel, and then do some simple string manipulation (such as Regex) to extract what you need.

1 Like

Hello Reo,
In this video, download files via an HTTP request.

I attached the VB.NET code:

Dim httpRequest As HttpWebRequest = DirectCast(WebRequest.Create(“https://url.pdf”), HttpWebRequest)
httpRequest.Method = WebRequestMethods.Http.Get
Dim httpResponse As HttpWebResponse = DirectCast(httpRequest.GetResponse(), HttpWebResponse)
Dim httpResponseStream As Stream = httpResponse.GetResponseStream()
Dim doc As Byte()
Dim ms As MemoryStream = New MemoryStream()
doc = ms.ToArray()
File.WriteAllBytes(“C:\yourfile.pdf”, doc)

Cristian Negulescu

Hello, Cristian

Thank you for your solution.

I will try it~

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.