Как я могу загрузить вложение из HTTP-запроса, используя VB?
Мой пример кода
Dim oRequest As System.Net.HttpWebRequest = CType(HttpWebRequest.Create("Https://test.com"), HttpWebRequest)
Dim msg As MimeEntity
Dim mime_Ct As MimeKit.ContentType
mime_ct= MimeKit.ContentType.Parse(oRequest.ContentType)
Dim mime_part As MimeKit.MimeEntity
mime_part= MimeEntity.Load(mime_ct, oRequest.GetRequestStream())
Dim muli_part As MimeKit.Multipart
muli_part=DirectCast(mime_part,Multipart)
Dim i As Integer
For Each attachment As MimePart In muli_part
Dim filename As String
filename = "attachment"+CType(i,String)+".txt"
Console.WriteLine(filename)
Dim stream As New FileStream(filename,FileMode.Create)
attachment.ContentObject.DecodeTo(stream)
i=i+1
Next