C
Craig Buchanan
I am trying to save a MemoryStream (the attachment's Data property) to disk
using a FileStream. It seems that the MemoryStream's Read method is the
issue. The MemoryStream's size is 6680 bytes and its Position is 0.
Here's the code:
....
For Each attachment As Attachment In Attachments
Using FS As New FileStream(app_data & fileName, FileMode.Create)
Dim buffer(32768) As Byte
Dim size As Integer
'size is always 0, so the .Write method is never called.
While size = attachment .Data.Read(buffer, 0, buffer.Length)
End While
End Using
Next
....
What am I missing?
Thanks,
Craig Buchanan
using a FileStream. It seems that the MemoryStream's Read method is the
issue. The MemoryStream's size is 6680 bytes and its Position is 0.
Here's the code:
....
For Each attachment As Attachment In Attachments
Using FS As New FileStream(app_data & fileName, FileMode.Create)
Dim buffer(32768) As Byte
Dim size As Integer
'size is always 0, so the .Write method is never called.
While size = attachment .Data.Read(buffer, 0, buffer.Length)
FS.Write(buffer, 0, size)
End While
End Using
Next
....
What am I missing?
Thanks,
Craig Buchanan