private static StreamAttachment GetSharingMessageAttachment(MessageItem item) { bool flag = true; foreach (AttachmentHandle handle in item.AttachmentCollection) { Attachment attachment = item.AttachmentCollection.Open(handle, null); try { string valueOrDefault = attachment.GetValueOrDefault <string>(AttachmentSchema.AttachMimeTag, string.Empty); string valueOrDefault2 = attachment.GetValueOrDefault <string>(AttachmentSchema.AttachLongFileName, string.Empty); if (StringComparer.InvariantCultureIgnoreCase.Equals(valueOrDefault, "application/x-sharing-metadata-xml") && StringComparer.InvariantCultureIgnoreCase.Equals(valueOrDefault2, "sharing_metadata.xml") && attachment is StreamAttachment) { flag = false; return((StreamAttachment)attachment); } } finally { if (flag) { attachment.Dispose(); } } } return(null); }
internal AttachmentLink(Attachment attachment) { this.attachmentType = attachment.AttachmentType; this.attachmentId = attachment.Id; this.contentId = attachment.ContentId; this.contentBase = attachment.ContentBase; this.contentLocation = attachment.ContentLocation; this.filename = attachment.FileName; this.displayName = attachment.DisplayName; this.size = attachment.Size; this.originalIsInline = attachment.IsInline; this.markedInline = null; this.contentType = AttachmentLink.GetContentType(attachment); this.renderingPosition = attachment.GetValueOrDefault <int>(InternalSchema.RenderingPosition, -1); this.isHidden = attachment.GetValueOrDefault <bool>(InternalSchema.AttachCalendarHidden); this.isChanged = false; }