public FileInfo LogItem(Item item, out string result) { result = null; try { if (item != null) { FileInfo fileInfo = new FileInfo(this.GetFullFileName(item)); if (fileInfo.Exists) { return(fileInfo); } if (!fileInfo.Directory.Exists) { fileInfo.Directory.Create(); } using (Stream stream = fileInfo.Open(FileMode.CreateNew, FileAccess.ReadWrite)) { item.Load(StoreObjectSchema.ContentConversionProperties); ItemConversion.ConvertItemToMsgStorage(item, stream, this.OutboundConversionOptions); } return(fileInfo); } } catch (ConversionFailedException ex) { result = string.Format("{0} {1}", ex.Message, item.Id.ToBase64String()); } return(null); }
// Token: 0x06001988 RID: 6536 RVA: 0x000953D4 File Offset: 0x000935D4 internal Stream GetItemAttachmentStream(Attachment attachment, HttpContext httpContext) { OwaContext owaContext = OwaContext.Get(httpContext); UserContext userContext = owaContext.UserContext; OutboundConversionOptions outboundConversionOptions = Utilities.CreateOutboundConversionOptions(userContext); Stream stream = Streams.CreateTemporaryStorageStream(); string text = null; ItemAttachment itemAttachment = attachment as ItemAttachment; using (Item item = itemAttachment.GetItem(StoreObjectSchema.ContentConversionProperties)) { try { if (ItemConversion.IsItemClassConvertibleToMime(item.ClassName)) { ItemConversion.ConvertItemToMime(item, stream, outboundConversionOptions); text = ".eml"; } else if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(item.ClassName)) { (item as CalendarItemBase).ExportAsICAL(stream, "UTF-8", outboundConversionOptions); text = ".ics"; } else if (ObjectClass.IsContact(item.ClassName)) { Contact.ExportVCard(item as Contact, stream, outboundConversionOptions); text = ".vcf"; } else { ItemConversion.ConvertItemToMsgStorage(item, stream, outboundConversionOptions); } } catch (Exception) { stream = this.GetContentsReplacementStream(-1706159495); text = ".txt"; } } if (text != null) { this.fileName = this.GetConvertedItemFileName(this.fileName, text); this.encodedfileNameBytes = this.GetEncodedString(this.fileName); } stream.Position = 0L; return(stream); }