When using either the attachments.Save() method or the attachments.FileData method to save the file to disc, the following message is encoutered:
____We found a problem with some content in ???.xslx. Do you want us to try to recover as much as we can?____
This only occurs with xlsx attachments and the attachments are not corrupted when opened or saved directly from the mailbox.
The host I'm using in Office 365 and the script is using powershell. I've attached part of the code.
Regards, Matt
Comments: ** Comment from web user: barryjacobs **
____We found a problem with some content in ???.xslx. Do you want us to try to recover as much as we can?____
This only occurs with xlsx attachments and the attachments are not corrupted when opened or saved directly from the mailbox.
The host I'm using in Office 365 and the script is using powershell. I've attached part of the code.
Regards, Matt
Comments: ** Comment from web user: barryjacobs **
I had the same problem too, there's a bug in the Base64.cs FromBase64 function, that's causing the corruption.
I didn't fix this directly but found an alternative decode, that solves the problem:
byte[] output;
using (var ms = new MemoryStream())
using (var cs = new CryptoStream(ms, new FromBase64Transform(), CryptoStreamMode.Write))
using (var tr = new StreamWriter(cs))
{
tr.Write(s);
tr.Flush();
output = ms.ToArray();
}
return output;
This is referenced in:
http://stackoverflow.com/questions/28105486/decode-large-base64-strings