Using EncryptedEmails.Upload2 to send raw text yielding empty message (no item attached)

  • 1
  • Question
  • Updated 2 months ago
Using the following code to send raw text in an email.  The email is received, but no data is attached.  The email shows up in sent mail in the Sharefile web portal, but with no item attached.

What am I doing wrong?

        Dim objEncryptedEmail As Models.EncryptedEmail = objShareFileClient.EncryptedEmails.Create(objEncryptedEmailCreateParams).Execute

        Dim objUploadRequestParams As New Models.UploadRequestParams
        objUploadRequestParams.Raw = True
        objUploadRequestParams.FileName = "message.txt"
        objUploadRequestParams.FileSize = 0
        objUploadRequestParams.Method = Models.UploadMethod.Standard

        Dim objUploadSpecificationResponse As Models.UploadSpecification = objShareFileClient.EncryptedEmails.Upload2(objEncryptedEmail.url, objUploadRequestParams, 1).Execute

        Dim objHTTPWebRequest As HttpWebRequest = HttpWebRequest.Create(objUploadSpecificationResponse.ChunkUri)
        objHTTPWebRequest.Method = "POST"
        objHTTPWebRequest.ContentLength = p_strBody.Length

        Dim objStream As IO.Stream = objHTTPWebRequest.GetRequestStream()
        Dim objBytes() As Byte = New System.Text.UTF8Encoding().GetBytes(p_strBody)
        objStream.Write(objBytes, 0, objBytes.Length)
        Dim objWebResponse As WebResponse = objHTTPWebRequest.GetResponse

        Dim objEncryptedEmailSendParams As New Models.EncryptedEmailSendParams()
        Dim objItem As New Models.Item
        objItem.Id = System.Web.HttpUtility.ParseQueryString(objWebResponse.ResponseUri.Query)("uploadid")
        objEncryptedEmailSendParams.Message = objItem

Photo of Jeremy Sutka

Jeremy Sutka

  • 20 Posts
  • 1 Reply Like
  • like I am so close !

Posted 2 months ago

  • 1

Be the first to post a reply!