I am at the point in my appication where I am downloading an email attachment from an exchange server. I can save the attachment, but cannot open it.
Does this have something to do with the default encoding type I am using StreamWritier to write to the file, here's the constructor:
| StreamWriter (String) | Initializes a new
instance of the StreamWriter class for the specified file on the
specified path, using the default encoding and buffer size.
Supported by the .NET Compact Framework. |
Any help is much appreciated !
Thanks

Default Encoding
jjre
arch_angel81,
I think your problem is that you are trying to decode the bits of the zip file using UTF-8. This is quite likely to mangle your file, so that you won't be able to open it as a zip.
Try saving the bytes you get from the Convert.FromBase64String directly, and you should be ok.
HTH
--mc
Amritha
Now I am using this function to decode the email attachments from base64 to the default encoding:
This works with files that are not zipped. With archived files I lose the data (i.e. when I double- click on the archive it opens up fine, but there is not file inside).
Luis_Ga
Could you be more specific about the problems you're having opening the file Do you mean you can't open it by double-clicking on it, or a program you've written isn't able to read from the file Are you getting an error message or an exception, and if so could you post it
The encoding is one possible issue, but you'll need to provide more infomation about what you're trying to do with the file.
-Tom Meschter
Software Dev, Visual C# IDE
Russell81
- The archive is either in unknown format or damaged!
With text file attachments (.txt), the text comes out in the wrong format.
Thanks,
Jorijn--
back up a bit!
how are you getting the attachment and saving it
Bruce Bukovics
DKB
It works, it was the UTF-8 encoding that was messing things up!!!
systech