Hello,
Code that used to work a few years ago is now failing.
I'm reading in an email through EWS, getting the attachment and saving it to a SQL database.
The problem is for some reason the file size does not match the content size, as you can see below.
The content size is correct, and can be saved to the DB.
I have two SQL records, one saved by getting from disk, the other from EWS, and they are exactly the same.
Saving the incorrect file size does not allow me to load in the attachment into my ui, because the file size is incorrect.
This following example is an Excel 22KB attachment
As you can see the content size is 22016, whereas the attachment 'size' property is incorrectly set to 22352
Content {byte[22016]} byte[]
Size 22352 int
itItem.Attachments[i] {Microsoft.Exchange.WebServices.Data.FileAttachment}
Microsoft.Exchange.WebServices.Data.Attachment
{Microsoft.Exchange.WebServices.Data.FileAttachment}
Content {byte[22016]} byte[]
ContentId "B69182D944497F49B0EE99CBA1B215CA@namprd14.prod.outlook.com" string
ContentLocation null string
ContentType "application/vnd.ms-excel" string
FileName null string
IsContactPhoto false bool
IsInline false bool
LastModifiedTime {7/22/2021 2:07:51 PM} System.DateTime
Name "Attach Excel.xls" string
Size 22352 i nt
Id "AQMkADAwATM0MDAAMS0yZWIzLTVjMmItMDACLTAwCgBGAAAD8QDBv3KkD0OTTIYQjKXPLgcAhjZRaTuzP0qwyGWN/oN3kwAAAgEMAAAAhjZRaTuzP0qwyGWN/oN3kwAAAQEt4AAAAAESABAAxUotxNfcTk4AiwCEWseJa6w=" string
Any ideas what's up?
Thank you,