public override CalendarItemBase GetEmbeddedItem() { this.CheckDisposed("GetEmbeddedItem"); ExTraceGlobals.MeetingMessageTracer.Information <GlobalObjectId>((long)this.GetHashCode(), "Storage.MeetingMessage.GetEmbeddedItem: GOID={0}", this.GlobalObjectId); CalendarItemBase calendarItemBase = null; bool flag = false; CalendarItemBase result; try { ItemCreateInfo calendarItemInfo = ItemCreateInfo.CalendarItemInfo; calendarItemBase = ItemBuilder.ConstructItem <CalendarItem>(base.Session, base.StoreObjectId, (base.StoreObjectId != null) ? base.Id.ChangeKeyAsByteArray() : null, calendarItemInfo.Schema.AutoloadProperties, delegate { AcrPropertyBag acrPropertyBag = null; PersistablePropertyBag persistablePropertyBag = null; bool flag2 = false; StoreObjectId storeObjectId = base.StoreObjectId; PersistablePropertyBag result2; try { if (storeObjectId != null && !storeObjectId.IsFakeId) { persistablePropertyBag = StoreObjectPropertyBag.CreatePropertyBag(base.Session, storeObjectId, InternalSchema.ContentConversionProperties); acrPropertyBag = new AcrPropertyBag(persistablePropertyBag, AcrProfile.AppointmentProfile, storeObjectId, new ItemBagFactory(base.Session, base.StoreObjectId), null); flag2 = true; result2 = acrPropertyBag; } else { persistablePropertyBag = new StoreObjectPropertyBag(base.Session, base.MapiProp, InternalSchema.ContentConversionProperties, false); flag2 = true; result2 = persistablePropertyBag; } } finally { if (!flag2) { Util.DisposeIfPresent(persistablePropertyBag); Util.DisposeIfPresent(acrPropertyBag); } } return(result2); }, calendarItemInfo.Creator, base.CoreObject.Origin, base.CoreObject.ItemLevel); flag = true; result = calendarItemBase; } finally { if (!flag && calendarItemBase != null) { calendarItemBase.Dispose(); calendarItemBase = null; } } return(result); }
public static RightsManagedMessageItem CreateInMemory(OutboundConversionOptions options) { Util.ThrowOnNullArgument(options, "options"); RightsManagedMessageItem rightsManagedMessageItem = null; using (DisposeGuard disposeGuard = default(DisposeGuard)) { rightsManagedMessageItem = ItemBuilder.ConstructItem <RightsManagedMessageItem>(null, null, null, StoreObjectSchema.ContentConversionProperties, () => new InMemoryPersistablePropertyBag(StoreObjectSchema.ContentConversionProperties), ItemCreateInfo.RightsManagedMessageItemInfo.Creator, Origin.Existing, ItemLevel.TopLevel); disposeGuard.Add <RightsManagedMessageItem>(rightsManagedMessageItem); rightsManagedMessageItem[InternalSchema.ItemClass] = "IPM.Note"; rightsManagedMessageItem.InitNewItem(options); rightsManagedMessageItem.SetDefaultEnvelopeBody(null); disposeGuard.Success(); } return(rightsManagedMessageItem); }
private void PopulateExceptionOccurrence(object[] occurrence, PropertyDefinition[] columns, ExceptionInfo exception, ref AttachmentCollection attachments, ref Item master, VersionedId versionedId) { object[] array = null; for (int i = 0; i < columns.Length; i++) { if (!columns[i].Equals(InternalSchema.ItemId) && !columns[i].Equals(InternalSchema.IsRecurring) && !columns[i].Equals(InternalSchema.IsException) && !columns[i].Equals(InternalSchema.AppointmentRecurring) && !columns[i].Equals(InternalSchema.MapiStartTime) && !columns[i].Equals(InternalSchema.MapiPRStartDate) && !columns[i].Equals(InternalSchema.MapiEndTime) && !columns[i].Equals(InternalSchema.MapiPREndDate) && !columns[i].Equals(InternalSchema.CalendarItemType) && !columns[i].Equals(InternalSchema.GlobalObjectId) && !columns[i].Equals(InternalSchema.TimeZoneDefinitionStart) && !columns[i].Equals(InternalSchema.TimeZoneDefinitionEnd) && !columns[i].Equals(InternalSchema.Codepage) && !RecurrenceManager.MasterOnlyProperties.Contains(columns[i])) { if (RecurrenceManager.CanPropertyBeInExceptionData(columns[i])) { object obj = exception.PropertyBag.TryGetProperty(columns[i]); PropertyError propertyError = obj as PropertyError; if (propertyError != null) { if (propertyError.PropertyErrorCode != PropertyErrorCode.NotFound) { throw PropertyError.ToException(new PropertyError[] { propertyError }); } } else { occurrence[i] = obj; } } else { ExTraceGlobals.RecurrenceTracer.Information <PropertyDefinition>((long)this.recurrence.GetHashCode(), "RecurrenceManager::Expand, Opening embedded message for {0} property", columns[i]); if (array == null) { if (attachments == null) { if (master == null) { ExTraceGlobals.RecurrenceTracer.Information((long)this.recurrence.GetHashCode(), "RecurrenceManager::Expand. Fetching master message when constructing view"); StoreObjectId masterId = versionedId.ObjectId; bool flag = false; try { master = ItemBuilder.ConstructItem <Item>(this.storeSession, masterId, null, CalendarItemBaseSchema.Instance.AutoloadProperties, () => new StoreObjectPropertyBag(this.storeSession, this.storeSession.GetMapiProp(masterId), CalendarItemBaseSchema.Instance.AutoloadProperties), ItemCreateInfo.GenericItemInfo.Creator, Origin.Existing, ItemLevel.TopLevel); flag = true; } finally { if (!flag && master != null) { master.Dispose(); master = null; } } } attachments = master.AttachmentCollection; ExTraceGlobals.RecurrenceTracer.Information((long)this.recurrence.GetHashCode(), "RecurrenceManager::Expand, Fetching attachments"); } ItemAttachment itemAttachment = null; using (Item item = RecurrenceManager.OpenEmbeddedMessageAndAttachment(attachments, TimeZoneHelper.GetRecurringTimeZoneFromPropertyBag(attachments.ContainerItem.PropertyBag), exception.StartTime, exception.EndTime, out itemAttachment, columns)) { ExTraceGlobals.RecurrenceTracer.Information <ExDateTime>((long)this.recurrence.GetHashCode(), "RecurrenceManager::Expand, Fetching Embedded Message for exception occurence dateId: {0}", exception.OccurrenceDateId); if (item != null) { array = item.GetProperties(columns); itemAttachment.Dispose(); } else { array = new object[columns.Length]; } } } if (array[i] != null && !(array[i] is PropertyError)) { occurrence[i] = array[i]; } } } } }