protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
 {
     byte[] valueOrDefault = propertyBag.GetValueOrDefault <byte[]>(InternalSchema.PropertyChangeMetadataRaw);
     if (valueOrDefault == null)
     {
         CalendarItemOccurrence calendarItemOccurrence = propertyBag.Context.StoreObject as CalendarItemOccurrence;
         if (calendarItemOccurrence == null)
         {
             return(null);
         }
         return(calendarItemOccurrence.OccurrencePropertyBag.ComputeChangeMetadataBasedOnLoadedProperties());
     }
     else
     {
         if (valueOrDefault.Length == 0)
         {
             return(null);
         }
         object result;
         try
         {
             result = PropertyChangeMetadata.Parse(valueOrDefault);
         }
         catch (PropertyChangeMetadataFormatException ex)
         {
             result = new PropertyError(this, PropertyErrorCode.CorruptedData, ex.Message);
         }
         return(result);
     }
 }
 protected internal override CalendarItemOccurrence RecoverDeletedOccurrence()
 {
     if (this.possibleDeletedOccurrenceId != null)
     {
         MailboxSession calendarMailboxSession = MeetingMessage.GetCalendarMailboxSession(this);
         for (int i = 0; i < 2; i++)
         {
             CalendarItem calendarItem = CalendarItem.Bind(calendarMailboxSession, StoreObjectId.FromProviderSpecificId(this.possibleDeletedOccurrenceId.ProviderLevelItemId, StoreObjectType.CalendarItem));
             try
             {
                 calendarItem.OpenAsReadWrite();
                 if (calendarItem.Recurrence != null)
                 {
                     InternalRecurrence internalRecurrence = (InternalRecurrence)calendarItem.Recurrence;
                     ExDateTime         occurrenceId       = ((OccurrenceStoreObjectId)this.possibleDeletedOccurrenceId).OccurrenceId;
                     if (internalRecurrence.IsValidOccurrenceId(occurrenceId))
                     {
                         if (internalRecurrence.IsOccurrenceDeleted(occurrenceId))
                         {
                             base.LocationIdentifierHelperInstance.SetLocationIdentifier(39541U, LastChangeAction.RecoverDeletedOccurance);
                             calendarItem.RecoverDeletedOccurrence(this.possibleDeletedOccurrenceId);
                             if (calendarItem.Save(SaveMode.ResolveConflicts).SaveStatus == SaveResult.IrresolvableConflict)
                             {
                                 goto IL_136;
                             }
                         }
                         CalendarItemOccurrence calendarItemOccurrence = CalendarItemOccurrence.Bind(calendarMailboxSession, this.possibleDeletedOccurrenceId, MeetingMessageSchema.Instance.AutoloadProperties);
                         calendarItemOccurrence.OpenAsReadWrite();
                         ExTraceGlobals.MeetingMessageTracer.Information <GlobalObjectId>((long)this.GetHashCode(), "Storage.MeetingMessage.RecoverDeletedOccurrence: GOID={0}; occurrence recovered.", this.GlobalObjectId);
                         return(calendarItemOccurrence);
                     }
                     ExTraceGlobals.MeetingMessageTracer.Information <GlobalObjectId>((long)this.GetHashCode(), "Storage.MeetingMessage.RecoverDeletedOccurrence: GOID={0}; occurrence id is invalid.", this.GlobalObjectId);
                     return(null);
                 }
             }
             catch (OccurrenceNotFoundException)
             {
                 ExTraceGlobals.MeetingMessageTracer.Information <GlobalObjectId>((long)this.GetHashCode(), "Storage.MeetingMessage.RecoverDeletedOccurrence: GOID={0}; occurrence not found.", this.GlobalObjectId);
                 return(null);
             }
             finally
             {
                 calendarItem.Dispose();
             }
             IL_136 :;
         }
     }
     ExTraceGlobals.MeetingMessageTracer.Information <GlobalObjectId>((long)this.GetHashCode(), "Storage.MeetingMessage.RecoverDeletedOccurrence: GOID={0}; occurrence not recovered.", this.GlobalObjectId);
     return(null);
 }
Ejemplo n.º 3
0
        private void UpdateCalendarItemProperties(CalendarItemBase calendarItemBase)
        {
            CalendarItemOccurrence calendarItemOccurrence = calendarItemBase as CalendarItemOccurrence;
            CalendarItem           calendarItem           = calendarItemBase as CalendarItem;
            bool preserveLocalExceptions = false;

            if (calendarItemOccurrence != null)
            {
                calendarItemOccurrence.MakeModifiedOccurrence();
            }
            else if (calendarItem != null)
            {
                preserveLocalExceptions = this.ShouldPreserveLocalExceptions(calendarItem);
            }
            this.CopyMeetingRequestProperties(calendarItemBase, preserveLocalExceptions);
        }
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            bool valueOrDefault = propertyBag.GetValueOrDefault <bool>(InternalSchema.AppointmentRecurring);

            if (valueOrDefault)
            {
                AppointmentStateFlags valueOrDefault2 = propertyBag.GetValueOrDefault <AppointmentStateFlags>(InternalSchema.AppointmentStateInternal);
                return(CalendarItemBase.IsAppointmentStateCancelled(valueOrDefault2));
            }
            CalendarItemOccurrence calendarItemOccurrence = propertyBag.Context.StoreObject as CalendarItemOccurrence;

            if (calendarItemOccurrence != null)
            {
                AppointmentStateFlags valueOrDefault3 = calendarItemOccurrence.OccurrencePropertyBag.MasterCalendarItem.GetValueOrDefault <AppointmentStateFlags>(CalendarItemBaseSchema.AppointmentState);
                return(CalendarItemBase.IsAppointmentStateCancelled(valueOrDefault3));
            }
            return(new PropertyError(this, PropertyErrorCode.NotFound));
        }
Ejemplo n.º 5
0
        internal OccurrenceAttendeeCollection(CalendarItemOccurrence occurrence)
        {
            this.occurrence = occurrence;
            this.LoadMasterAttendeeCollection();
            CoreRecipientCollection recipients;

            if (occurrence.OccurrencePropertyBag.ExceptionMessage != null)
            {
                recipients = occurrence.OccurrencePropertyBag.ExceptionMessage.CoreItem.Recipients;
            }
            else
            {
                recipients = occurrence.OccurrencePropertyBag.MasterCalendarItem.CoreItem.Recipients;
                CalendarItem masterCalendarItem = occurrence.OccurrencePropertyBag.MasterCalendarItem;
            }
            this.exceptionAttendeeCollection = new AttendeeCollection(recipients);
            this.BuildOccurrenceAttendeeCollection();
        }
Ejemplo n.º 6
0
 private void CalculateOccurrencesToRevive()
 {
     this.OccurrencesToRevive = new List <ExDateTime>();
     foreach (ExDateTime exDateTime in this.NewRecurrence.GetDeletedOccurrences(false))
     {
         ExDateTime date = exDateTime.Date;
         if (this.OriginalRecurrence.IsValidOccurrenceId(date) && !this.OriginalRecurrence.IsOccurrenceDeleted(date))
         {
             OccurrenceInfo occurrenceInfoByDateId = this.OriginalRecurrence.GetOccurrenceInfoByDateId(date);
             using (CalendarItemOccurrence calendarItemOccurrence = CalendarItemOccurrence.Bind(this.Session, occurrenceInfoByDateId.VersionedId))
             {
                 if (calendarItemOccurrence.IsCancelled)
                 {
                     this.OccurrencesToRevive.Add(occurrenceInfoByDateId.OccurrenceDateId);
                 }
             }
         }
     }
     ExTraceGlobals.RecurrenceTracer.Information <string>((long)this.GetHashCode(), "Storage.RecurrenceBlobMerger.CalculateOccurrencesToRevive: GOID={0}", this.GlobalObjectId);
 }
Ejemplo n.º 7
0
        internal ReplyForwardCommon(Item originalItem, Item newItem, ReplyForwardConfiguration parameters, bool decodeSmime)
        {
            Util.ThrowOnNullArgument(parameters, "parameters");
            if (decodeSmime && ObjectClass.IsSmime(originalItem.ClassName))
            {
                if (parameters.ConversionOptionsForSmime == null || parameters.ConversionOptionsForSmime.IgnoreImceaDomain || parameters.ConversionOptionsForSmime.ImceaEncapsulationDomain == null)
                {
                    throw new InvalidOperationException("Cannot decode SMIME without valid ConversionOptionsForSmime");
                }
                this.originalItem = originalItem;
                MessageItem messageItem = originalItem as MessageItem;
                if (messageItem != null)
                {
                    Item item = messageItem.FetchSmimeContent(parameters.ConversionOptionsForSmime.ImceaEncapsulationDomain);
                    if (item != null)
                    {
                        this.originalItem = item;
                        this.originalItem[InternalSchema.NormalizedSubjectInternal] = messageItem.GetValueOrDefault <string>(InternalSchema.NormalizedSubjectInternal, string.Empty);
                        this.originalItem[InternalSchema.Sender] = messageItem.Sender;
                        this.originalItem[InternalSchema.From]   = messageItem.From;
                    }
                }
            }
            else
            {
                this.originalItem = originalItem;
            }
            this.newItem    = newItem;
            this.parameters = parameters;
            this.culture    = ReplyForwardUtils.CalculateReplyForwardCulture(parameters.Culture, newItem);
            if (this.culture == null)
            {
                throw new InvalidOperationException("Forward message culture is unknown");
            }
            this.FetchPropertiesFromOriginalItem();
            if (originalItem is MessageItem)
            {
                if (originalItem.MapiMessage != null)
                {
                    SetReadFlags readFlag = parameters.ShouldSuppressReadReceipt ? SetReadFlags.SuppressReceipt : SetReadFlags.None;
                    try
                    {
                        StoreSession session = originalItem.Session;
                        bool         flag    = false;
                        try
                        {
                            if (session != null)
                            {
                                session.BeginMapiCall();
                                session.BeginServerHealthCall();
                                flag = true;
                            }
                            if (StorageGlobals.MapiTestHookBeforeCall != null)
                            {
                                StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                            }
                            originalItem.MapiMessage.SetReadFlag(readFlag);
                        }
                        catch (MapiPermanentException ex)
                        {
                            throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotSetReadFlags, ex, session, this, "{0}. MapiException = {1}.", new object[]
                            {
                                string.Format("ReplyForwardCommon::ctor.", new object[0]),
                                ex
                            });
                        }
                        catch (MapiRetryableException ex2)
                        {
                            throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotSetReadFlags, ex2, session, this, "{0}. MapiException = {1}.", new object[]
                            {
                                string.Format("ReplyForwardCommon::ctor.", new object[0]),
                                ex2
                            });
                        }
                        finally
                        {
                            try
                            {
                                if (session != null)
                                {
                                    session.EndMapiCall();
                                    if (flag)
                                    {
                                        session.EndServerHealthCall();
                                    }
                                }
                            }
                            finally
                            {
                                if (StorageGlobals.MapiTestHookAfterCall != null)
                                {
                                    StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                                }
                            }
                        }
                    }
                    catch (StoragePermanentException)
                    {
                    }
                    catch (StorageTransientException)
                    {
                    }
                }
                (this.originalItem as MessageItem).IsRead = true;
            }
            else if (this.originalItem is CalendarItemOccurrence)
            {
                this.parentPropValues[ParentPropertyIndex.IsRecurring]               = true;
                this.parentPropValues[ParentPropertyIndex.AppointmentRecurring]      = false;
                this.parentPropValues[ParentPropertyIndex.RecurrenceType]            = 0;
                this.parentPropValues[ParentPropertyIndex.TimeZoneBlob]              = new PropertyError(InternalSchema.TimeZoneBlob, PropertyErrorCode.NotFound);
                this.parentPropValues[ParentPropertyIndex.AppointmentRecurrenceBlob] = new PropertyError(InternalSchema.AppointmentRecurrenceBlob, PropertyErrorCode.NotFound);
                this.parentPropValues[ParentPropertyIndex.IsException]               = true;
                if (string.IsNullOrEmpty(this.parentPropValues[ParentPropertyIndex.RecurrencePattern] as string))
                {
                    CalendarItemOccurrence calendarItemOccurrence = this.originalItem as CalendarItemOccurrence;
                    this.parentPropValues[ParentPropertyIndex.RecurrencePattern] = calendarItemOccurrence.OccurrencePropertyBag.MasterCalendarItem.GenerateWhen();
                }
            }
            string valueOrDefault = originalItem.GetValueOrDefault <string>(InternalSchema.ItemClass, string.Empty);

            this.originalItemSigned = (ObjectClass.IsOfClass(valueOrDefault, "IPM.Note.Secure.Sign") || ObjectClass.IsSmimeClearSigned(valueOrDefault));
            if (!this.originalItemSigned)
            {
                this.originalItemEncrypted = (ObjectClass.IsOfClass(valueOrDefault, "IPM.Note.Secure") || ObjectClass.IsSmime(valueOrDefault));
            }
            string valueOrDefault2 = originalItem.GetValueOrDefault <string>(InternalSchema.ContentClass, string.Empty);

            this.originalItemIrm = ObjectClass.IsRightsManagedContentClass(valueOrDefault2);
        }
 internal CustomReminder(CalendarItemOccurrence item) : base(item)
 {
 }
 protected override void SetDeclineIntent(bool intendToSendResponse)
 {
     this.OccurrencePropertyBag.MasterCalendarItem.ClientIntent = CalendarItemOccurrence.GetDeclineIntent(intendToSendResponse);
 }
 public new static CalendarItemOccurrence Bind(StoreSession session, StoreId storeId)
 {
     return(CalendarItemOccurrence.Bind(session, storeId, null));
 }