Office 365 Attachments Using Office 365 Activities

Hi,

I am trying to get an attachment from an Office 365 email and save it to a local robot directory. I have tried from tutorials online but haven’t been successful. Does anyone have a example they would be willing to share? I have used the 365 activity to send mail but all I need to do is look for a unread email, and retrieve the attachment. It sounded straight forward but has not worked. Thanks.

Use the Get Exchange Mail Messages activity
image

Hi,
yes it is feasible.
Let’s say you have a variable “att” of type Attachment, then you can do like this:

attStream = att.ContentStream() //attStream is of type Stream
ReDim attBytes(CInt(attStream.Length)) //attBytes is a Byte Array
attStream.Read(attBytes,0,CInt(attStream.Length))
System.IO.File.WriteAllBytes(Path.Combine(“documents”,att.Name),attBytes)

I hope it helps,
Regards