Example #1
0
 internal AttachmentInfo(StoreObjectId messageId, Attachment attachment)
 {
     this.fileName      = attachment.FileName;
     this.fileExtension = attachment.FileExtension;
     this.displayName   = attachment.DisplayName;
     this.contentType   = attachment.ContentType;
     if (string.IsNullOrEmpty(this.contentType))
     {
         this.contentType = attachment.CalculatedContentType;
     }
     this.isInline         = attachment.IsInline;
     this.size             = attachment.Size;
     this.attachmentType   = attachment.AttachmentType;
     this.messageId        = messageId;
     this.attachmentId     = attachment.Id;
     this.contentId        = attachment.ContentId;
     this.lastModifiedTime = attachment.LastModifiedTime;
     this.contentLocation  = attachment.ContentLocation;
     if (attachment.AttachmentType == AttachmentType.Stream)
     {
         StreamAttachment streamAttachment = attachment as StreamAttachment;
         if (streamAttachment != null)
         {
             this.imageThumbnail       = streamAttachment.LoadAttachmentThumbnail();
             this.imageThumbnailHeight = streamAttachment.ImageThumbnailHeight;
             this.imageThumbnailWidth  = streamAttachment.ImageThumbnailWidth;
             if (this.imageThumbnail != null)
             {
                 this.salientRegions = streamAttachment.LoadAttachmentThumbnailSalientRegions();
             }
         }
     }
     if (attachment.AttachmentType == AttachmentType.EmbeddedMessage)
     {
         ItemAttachment itemAttachment = attachment as ItemAttachment;
         if (itemAttachment != null)
         {
             using (Item item = itemAttachment.GetItem())
             {
                 this.embeddedItemClass = item.ClassName;
             }
         }
     }
     if (attachment.AttachmentType == AttachmentType.Reference)
     {
         ReferenceAttachment referenceAttachment = attachment as ReferenceAttachment;
         if (referenceAttachment != null)
         {
             this.attachLongPathName = referenceAttachment.AttachLongPathName;
             this.providerType       = referenceAttachment.ProviderType;
         }
     }
 }
 internal override void CoreObjectUpdate(CoreAttachment coreAttachment)
 {
     base.CoreObjectUpdate(coreAttachment);
     ReferenceAttachment.CoreObjectUpdateReferenceAttachmentName(coreAttachment);
 }