NJ  Bhanushali

NJ Bhanushali

  • NA
  • 13
  • 15.7k

How to get filesize from attachment in Exchange 2007?

Aug 21 2015 12:32 AM
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);
    }
   }
 
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?
 

Answers (2)