Пример #1
0
 internal override StoreObjectValidationError Validate(ValidationContext context, IValidatablePropertyBag validatablePropertyBag)
 {
     if (ObjectClass.IsCalendarItem((validatablePropertyBag.TryGetProperty(InternalSchema.ItemClass) as string) ?? string.Empty))
     {
         PersistablePropertyBag persistablePropertyBag = validatablePropertyBag as PersistablePropertyBag;
         if (persistablePropertyBag != null)
         {
             byte[] largeBinaryProperty = persistablePropertyBag.GetLargeBinaryProperty(InternalSchema.AppointmentRecurrenceBlob);
             if (largeBinaryProperty != null)
             {
                 ExTimeZone createTimeZone = TimeZoneHelper.GetRecurringTimeZoneFromPropertyBag(persistablePropertyBag) ?? ExTimeZone.CurrentTimeZone;
                 try
                 {
                     InternalRecurrence.InternalParse(largeBinaryProperty, persistablePropertyBag.TryGetProperty(InternalSchema.ItemId) as VersionedId, createTimeZone, persistablePropertyBag.ExTimeZone, CalendarItem.DefaultCodePage);
                 }
                 catch (RecurrenceCalendarTypeNotSupportedException ex)
                 {
                     ExTraceGlobals.RecurrenceTracer.TraceDebug <CalendarType>((long)this.GetHashCode(), "RecurrenceBlobConstraint::Validate. Not supported calendar type found. CalendarType:{0}", ex.CalendarType);
                 }
                 catch (RecurrenceFormatException)
                 {
                     return(new StoreObjectValidationError(context, InternalSchema.AppointmentRecurrenceBlob, largeBinaryProperty, this));
                 }
             }
         }
     }
     return(null);
 }
Пример #2
0
        public static ExTimeZone GetExTimeZoneFromItem(Item item)
        {
            ExTimeZone exTimeZone = TimeZoneHelper.GetRecurringTimeZoneFromPropertyBag(item.PropertyBag);

            if (exTimeZone == null)
            {
                exTimeZone = TimeZoneHelper.GetTimeZoneFromProperties("Customized Time Zone", null, item.GetValueOrDefault <byte[]>(InternalSchema.TimeZoneDefinitionStart));
            }
            if (exTimeZone == null)
            {
                if (item.Session != null && item.Session.ExTimeZone != ExTimeZone.UtcTimeZone)
                {
                    exTimeZone = item.Session.ExTimeZone;
                }
                else
                {
                    ExTimeZoneHelperForMigrationOnly.CheckValidationLevel(false, ExTimeZoneHelperForMigrationOnly.ValidationLevel.Low, "TimeZoneHelper.GetTimeZoneFromItem: no time zone", new object[0]);
                    exTimeZone = ExTimeZone.CurrentTimeZone;
                }
            }
            return(exTimeZone);
        }
Пример #3
0
 public static ExTimeZone GetRecurringTimeZoneFromPropertyBag(PropertyBag propertyBag)
 {
     return(TimeZoneHelper.GetRecurringTimeZoneFromPropertyBag(propertyBag.AsIStorePropertyBag()));
 }
Пример #4
0
 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];
                 }
             }
         }
     }
 }