0

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 ?

3
  • stackoverflow.com/questions/10954293/… Commented May 18, 2020 at 17:53
  • @TimWilliams found this article, is possible to implement this code to my code and send all datas together ? Commented May 18, 2020 at 17:55
  • Yes you can do that Commented May 18, 2020 at 17:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.