I have VBA script in Outlook 2019, for sending datas to API and store in MYSQL database. But in my case need Outlook atachment convert to binary file and send to API.
VBA Script for sending datas to APi:
Dim SendDataToApi As String
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
URL = "https://url.domain.com/api/dataInsert"
objHTTP.Open "POST", URL, False
objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
SendDataToApi = "mail_from=" & strFrom & "&mail_to=" & strFrom & "&mobile_phone=123456789&date_send=2020-05-14&date_expiration=2020-05-15"
objHTTP.Send SendDataToApi
VBA script for 7zip all atechment to one file:
For Each objAttachment In objMail.Attachments
objAttachment.SaveAsFile cstrFileAttachment & objAttachment.FileName
Next objAtachment
strSource = cstrFolderAttachment & "*.*"
strDestination = cstrFolderAttachment & "Zip\attachment.zip"
strCommand = """" & PathZipProgram & """ a -tzip """ & strDestination & _
""" -p" """ & strSource & """"
This moment i have all attachments from mail saved in 7zip in local folder. My goal is convert this 7zip file to binary file and send to API together with rest of this code:
SendDataToApi = "mail_from=" & strFrom & "&mail_to=" & strFrom & "&mobile_phone=123456789&date_send=2020-05-14&date_expiration=2020-05-15"
is possible to achive this ?