Hello,
if (email.HasAttachments)
{
AttachmentList AttachmentFiles = new AttachmentList(); //class for attachment list
foreach (Attachment attachment in email.Attachments)
{
if (attachment is FileAttachment)
{
FileAttachment fileAttachment = attachment as FileAttachment;
attachmentEntity.MailID = MailID;
attachmentEntity.Filename = fileAttachment.FileName;
attachmentEntity.FileSize = fileAttachment.Size;
attachmentEntity.File = fileAttachment.Content;
attachmentEntity.CreatedDate = fileAttachment.LastModifiedTime;
AttachmentFiles.Add(attachmentEntity);
}
}
}
{
AttachmentList AttachmentFiles = new AttachmentList(); //class for attachment list
foreach (Attachment attachment in email.Attachments)
{
if (attachment is FileAttachment)
{
FileAttachment fileAttachment = attachment as FileAttachment;
attachmentEntity.MailID = MailID;
attachmentEntity.Filename = fileAttachment.FileName;
attachmentEntity.FileSize = fileAttachment.Size;
attachmentEntity.File = fileAttachment.Content;
attachmentEntity.CreatedDate = fileAttachment.LastModifiedTime;
AttachmentFiles.Add(attachmentEntity);
}
}
}
I got following error. The property Last Modified Time and Size are valid only for Exchange Exchange 2010 or later versions.
How to get filesize and LastupdateTime from attachment in Exchange Server 2007 email account?

Sumit JoshiRank #1,252 · 1.4K reputationPosted Aug 20, 2015, 9:29 PM EDT
NJ Bhanushali13 reputationPosted Aug 20, 2015, 9:43 PM EDT