コード例 #1
0
        private MeetingInquiryAction TryRepairMissingItem(CalendarVersionStoreGateway cvsGateway, byte[] calendarFolderId)
        {
            MeetingInquiryAction result;

            MeetingInquiryMessage.WouldTryToRepairIfMissing(cvsGateway, this.GlobalObjectId, this.MailboxSession, this, true, calendarFolderId, out result);
            return(result);
        }
コード例 #2
0
 // Token: 0x06000791 RID: 1937 RVA: 0x00035A34 File Offset: 0x00033C34
 public void ProcessMeetingInquiryMessage(CalendarVersionStoreGateway cvsGateway, MailboxSession itemStore, MeetingInquiryMessage message)
 {
     if (this.PreProcessMessage(itemStore, message, message.IsProcessed, message.CalendarProcessed))
     {
         MeetingInquiryAction processAction;
         try
         {
             itemStore.COWSettings.TemporaryDisableHold = true;
             processAction = message.Process(cvsGateway);
         }
         finally
         {
             itemStore.COWSettings.TemporaryDisableHold = false;
         }
         CalendarProcessing.LogHandler.UpdateItemContent(itemStore, (string currentContent) => string.Format("{0}{1}{2} MeetingInquiryMessage(GOID:{3}) {4}", new object[]
         {
             currentContent,
             Environment.NewLine,
             ExDateTime.UtcNow,
             message.GlobalObjectId,
             processAction
         }));
         this.TraceDebugAndPfd(message.GetHashCode(), string.Format("{0}: Completed processing of the inquiry message (Action: {1})", TraceContext.Get(), processAction));
     }
 }
コード例 #3
0
        private bool IsOrganizerValid(MailboxSession organizerSession, CalendarInstanceContext instanceContext)
        {
            bool isOrganizer = false;
            CalendarVersionStoreGateway cvsGateway = instanceContext.ValidationContext.CvsGateway;

            cvsGateway.QueryByGlobalObjectId(organizerSession, instanceContext.ValidationContext.BaseItem.GlobalObjectId, string.Empty, new StorePropertyDefinition[]
            {
                StoreObjectSchema.ItemClass,
                CalendarItemBaseSchema.AppointmentState
            }, delegate(PropertyBag propertyBag)
            {
                string valueOrDefault = propertyBag.GetValueOrDefault <string>(StoreObjectSchema.ItemClass);
                if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(valueOrDefault))
                {
                    AppointmentStateFlags valueOrDefault2 = propertyBag.GetValueOrDefault <AppointmentStateFlags>(CalendarItemBaseSchema.AppointmentState);
                    isOrganizer = ((valueOrDefault2 & AppointmentStateFlags.Received) == AppointmentStateFlags.None);
                    if (!isOrganizer)
                    {
                        return(false);
                    }
                }
                return(true);
            }, false, null, null, null);
            return(isOrganizer);
        }
コード例 #4
0
        private static bool PairWithCancellation(CalendarVersionStoreGateway cvsGateway, CalendarItemBase deletedVersion, MailboxSession session)
        {
            bool pairedWithCancellation    = false;
            int  deletedItemSequenceNumber = deletedVersion.AppointmentSequenceNumber;

            cvsGateway.QueryByGlobalObjectId(session, deletedVersion.GlobalObjectId, "{B7DF6DD0-6F29-42b4-A1AE-44A0733782AA}", MeetingInquiryMessage.cancellationQueryProperties, delegate(PropertyBag propertyBag)
            {
                int valueOrDefault = propertyBag.GetValueOrDefault <int>(CalendarItemBaseSchema.AppointmentSequenceNumber);
                if (valueOrDefault >= deletedItemSequenceNumber)
                {
                    pairedWithCancellation = true;
                }
                return(false);
            }, true, MeetingInquiryMessage.cancellationClassArray, null, null);
            return(pairedWithCancellation);
        }
コード例 #5
0
        private Dictionary <string, List <VersionedId> > GetAllCalendarLogItems(MailboxSession mailboxSession)
        {
            CalendarVersionStoreGateway calendarVersionStoreGateway = new CalendarVersionStoreGateway(default(CalendarVersionStoreQueryPolicy), true);
            Dictionary <string, List <VersionedId> > resultTree     = new Dictionary <string, List <VersionedId> >();

            try
            {
                if (this.itemId != null)
                {
                    using (Item item = Item.Bind(mailboxSession, this.itemId, ItemBindOption.LoadRequiredPropertiesOnly, GetCalendarDiagnosticLog.requiredIdProperties))
                    {
                        this.Subject = item.GetValueOrDefault <string>(ItemSchema.Subject);
                        byte[] valueOrDefault = item.GetValueOrDefault <byte[]>(CalendarItemBaseSchema.CleanGlobalObjectId);
                        if (valueOrDefault != null)
                        {
                            string cleanGoidKey = this.GetCleanGoidKey(valueOrDefault);
                            calendarVersionStoreGateway.QueryByCleanGlobalObjectId(mailboxSession, new GlobalObjectId(valueOrDefault), "{735AA13D-42D0-4610-BDCB-3DF048D33957}", GetCalendarDiagnosticLog.requiredIdProperties, (PropertyBag propertyBag) => this.AddItemToResultTree(cleanGoidKey, resultTree, propertyBag), false, null, this.StartDate, this.EndDate);
                        }
                        else
                        {
                            base.WriteError(new InvalidOperationException(Strings.GetCalendarDiagnosticLogNoCleanGoidErrorMessage.ToString()), ErrorCategory.InvalidData, this);
                        }
                        goto IL_170;
                    }
                }
                if (this.objectId != null)
                {
                    calendarVersionStoreGateway.QueryByCleanGlobalObjectId(mailboxSession, this.objectId, "{735AA13D-42D0-4610-BDCB-3DF048D33957}", GetCalendarDiagnosticLog.requiredIdProperties, (PropertyBag propertyBag) => this.AddItemToResultTree(this.MeetingID, resultTree, propertyBag), false, null, this.StartDate, this.EndDate);
                }
                else
                {
                    new HashSet <string>();
                    calendarVersionStoreGateway.QueryBySubjectContains(mailboxSession, this.Subject, "{735AA13D-42D0-4610-BDCB-3DF048D33957}", GetCalendarDiagnosticLog.requiredIdProperties, delegate(PropertyBag propertyBag)
                    {
                        byte[] array;
                        string cleanGoidKey = this.GetCleanGoidKey(propertyBag, out array);
                        this.AddItemToResultTree(cleanGoidKey, resultTree, propertyBag);
                    }, this.StartDate, this.EndDate);
                }
                IL_170 :;
            }
            catch (CalendarVersionStoreNotPopulatedException exception)
            {
                base.WriteError(exception, ErrorCategory.OperationTimeout, this);
            }
            return(resultTree);
        }
コード例 #6
0
        public MeetingInquiryAction Process(CalendarVersionStoreGateway cvsGateway)
        {
            this.CheckDisposed("Process");
            VersionedId id;

            MeetingInquiryMessage.ExistingCalendarItemError existingCalendarItemError;
            byte[] providerLevelItemId;
            using (CalendarFolder calendarFolder = CalendarFolder.Bind(this.MailboxSession, DefaultFolderType.Calendar))
            {
                existingCalendarItemError = this.CheckExistingCalendarItem(calendarFolder, out id);
                providerLevelItemId       = calendarFolder.Id.ObjectId.ProviderLevelItemId;
            }
            switch (existingCalendarItemError)
            {
            case MeetingInquiryMessage.ExistingCalendarItemError.None:
                return(this.TryRepairMissingItem(cvsGateway, providerLevelItemId));

            case MeetingInquiryMessage.ExistingCalendarItemError.MeetingAlreadyExists:
                return(MeetingInquiryAction.MeetingAlreadyExists);

            case MeetingInquiryMessage.ExistingCalendarItemError.OccurrenceInquiry:
                using (CalendarItem calendarItem = CalendarItem.Bind(base.Session, id))
                {
                    MeetingInquiryMessage.OccurrenceInquiryError occurrenceInquiryError = this.CheckOccurrence(calendarItem);
                    switch (occurrenceInquiryError)
                    {
                    case MeetingInquiryMessage.OccurrenceInquiryError.None:
                        return(this.TryRepairMissingItem(cvsGateway, providerLevelItemId));

                    case MeetingInquiryMessage.OccurrenceInquiryError.InvalidOccurrence:
                    {
                        UpdateRumInfo rumInfo = UpdateRumInfo.CreateMasterInstance(this.GetRumAttendees(calendarItem), CalendarInconsistencyFlag.RecurrenceBlob);
                        calendarItem.SendUpdateRums(rumInfo, false);
                        return(MeetingInquiryAction.SendUpdateForMaster);
                    }

                    case MeetingInquiryMessage.OccurrenceInquiryError.ExistingOccurrence:
                        return(MeetingInquiryAction.ExistingOccurrence);

                    default:
                        throw new InvalidOperationException(string.Format("An invalid error code is returned: {0}.", occurrenceInquiryError));
                    }
                }
                break;
            }
            throw new InvalidOperationException(string.Format("An invalid error code is returned: {0}.", existingCalendarItemError));
        }
コード例 #7
0
        private static bool WouldTryToRepairIfMissing(CalendarVersionStoreGateway cvsGateway, GlobalObjectId globalObjectId, MailboxSession session, MeetingInquiryMessage message, bool performRepair, byte[] calendarFolderId, out MeetingInquiryAction predictedAction)
        {
            VersionedId versionedId;
            bool        result;

            if (MeetingInquiryMessage.TryGetCancelledVersionIdFromCvs(cvsGateway, globalObjectId, session, calendarFolderId, out versionedId))
            {
                if (performRepair)
                {
                    message.LocationIdentifierHelperInstance.SetLocationIdentifier(47383U, LastChangeAction.SendMeetingCancellations);
                    message.SendCancellationBasedOnFoundIntent(versionedId);
                }
                predictedAction = MeetingInquiryAction.SendCancellation;
                result          = true;
            }
            else
            {
                if (versionedId != null)
                {
                    using (CalendarItemBase calendarItemBase = CalendarItemBase.Bind(session, versionedId))
                    {
                        predictedAction = MeetingInquiryMessage.GetReviveAction(cvsGateway, session, calendarItemBase);
                        if (predictedAction == MeetingInquiryAction.ReviveMeeting)
                        {
                            if (performRepair)
                            {
                                predictedAction = message.TryReviveMeeting(calendarItemBase);
                            }
                            result = true;
                        }
                        else
                        {
                            result = false;
                        }
                        return(result);
                    }
                }
                ExTraceGlobals.MeetingMessageTracer.TraceDebug <string, GlobalObjectId>((long)session.GetHashCode(), "Storage.MeetingInquiryMessage::Process. Couldn't find deletion on mailbox {0}. Skipping GOID {1}", session.DisplayName, globalObjectId);
                predictedAction = MeetingInquiryAction.DeletedVersionNotFound;
                result          = false;
            }
            return(result);
        }
コード例 #8
0
        private static MeetingInquiryAction GetReviveAction(CalendarVersionStoreGateway cvsGateway, MailboxSession session, CalendarItemBase deletedVersion)
        {
            MeetingInquiryAction result;

            if (deletedVersion == null)
            {
                result = MeetingInquiryAction.DeletedVersionNotFound;
            }
            else
            {
                bool flag = false;
                try
                {
                    if (session.Capabilities.CanHaveDelegateUsers)
                    {
                        DelegateUserCollection delegateUserCollection = new DelegateUserCollection(session);
                        flag = (delegateUserCollection.Count > 0);
                    }
                }
                catch (DelegateUserNoFreeBusyFolderException)
                {
                    ExTraceGlobals.MeetingMessageTracer.Information((long)session.GetHashCode(), "Storage.MeetingInquiryMessage.GetReviveAction: NoFreeBusyData Folder, failing to get delegate rule type.");
                }
                catch (ObjectNotFoundException)
                {
                    ExTraceGlobals.MeetingMessageTracer.Information((long)session.GetHashCode(), "Storage.MeetingInquiryMessage.GetReviveAction: No delegates found, failing to get delegate rule type.");
                }
                if (!flag)
                {
                    result = (MeetingInquiryMessage.PairWithCancellation(cvsGateway, deletedVersion, session) ? MeetingInquiryAction.PairedCancellationFound : MeetingInquiryAction.ReviveMeeting);
                }
                else
                {
                    ExTraceGlobals.MeetingMessageTracer.TraceDebug <string, GlobalObjectId>((long)session.GetHashCode(), "Storage.MeetingInquiryMessage::GetReviveAction. Mailbox {0} has delegates so we can't get the cancellation from version store. Skipping GOID {1}", session.DisplayName, deletedVersion.GlobalObjectId);
                    result = MeetingInquiryAction.HasDelegates;
                }
            }
            return(result);
        }
コード例 #9
0
        private static bool TryGetCancelledVersionIdFromCvs(CalendarVersionStoreGateway cvsGateway, GlobalObjectId globalObjectId, MailboxSession session, byte[] calendarFolderId, out VersionedId deletedVersionId)
        {
            ClientIntentFlags clientIntentFlags;
            ClientIntentQuery clientIntentQuery;

            if (globalObjectId.IsCleanGlobalObjectId)
            {
                clientIntentFlags = ClientIntentFlags.MeetingCanceled;
                ICalendarItemStateDefinition deletedFromFolderStateDefinition = CompositeCalendarItemStateDefinition.GetDeletedFromFolderStateDefinition(calendarFolderId);
                clientIntentQuery = new ItemDeletionClientIntentQuery(globalObjectId, deletedFromFolderStateDefinition);
            }
            else
            {
                clientIntentFlags = ClientIntentFlags.MeetingExceptionCanceled;
                ICalendarItemStateDefinition targetState = new DeletedOccurrenceCalendarItemStateDefinition(globalObjectId.Date, false);
                clientIntentQuery = new NonTransitionalClientIntentQuery(globalObjectId, targetState);
            }
            ClientIntentQuery.QueryResult queryResult = clientIntentQuery.Execute(session, cvsGateway);
            deletedVersionId = queryResult.SourceVersionId;
            return(ClientIntentQuery.CheckDesiredClientIntent(queryResult.Intent, new ClientIntentFlags[]
            {
                clientIntentFlags
            }));
        }
コード例 #10
0
 public static bool WouldTryToRepairIfMissing(CalendarVersionStoreGateway cvsGateway, GlobalObjectId globalObjectId, MailboxSession session, byte[] calendarFolderId, out MeetingInquiryAction predictedAction)
 {
     return(MeetingInquiryMessage.WouldTryToRepairIfMissing(cvsGateway, globalObjectId, session, null, false, calendarFolderId, out predictedAction));
 }
コード例 #11
0
        internal static CalendarValidationContext CreateInstance(CalendarItemBase calendarItem, bool isOrganizer, UserObject localUser, UserObject remoteUser, CalendarVersionStoreGateway cvsGateway, AttendeeExtractor attendeeExtractor)
        {
            CalendarValidationContext calendarValidationContext = new CalendarValidationContext();

            calendarValidationContext.LocalUser  = localUser;
            calendarValidationContext.RemoteUser = remoteUser;
            if (isOrganizer)
            {
                calendarValidationContext.BaseRole     = RoleType.Organizer;
                calendarValidationContext.OppositeRole = RoleType.Attendee;
                calendarValidationContext.Organizer    = localUser;
                calendarValidationContext.Attendee     = remoteUser;
            }
            else
            {
                calendarValidationContext.BaseRole     = RoleType.Attendee;
                calendarValidationContext.OppositeRole = RoleType.Organizer;
                calendarValidationContext.Organizer    = remoteUser;
                calendarValidationContext.Attendee     = localUser;
            }
            calendarValidationContext.calendarItems = new Dictionary <RoleType, CalendarItemBase>(2);
            calendarValidationContext.calendarItems.Add(calendarValidationContext.BaseRole, calendarItem);
            calendarValidationContext.calendarItems.Add(calendarValidationContext.OppositeRole, null);
            calendarValidationContext.OrganizerRecurrence          = null;
            calendarValidationContext.OrganizerExceptions          = null;
            calendarValidationContext.OrganizerDeletions           = null;
            calendarValidationContext.AttendeeRecurrence           = null;
            calendarValidationContext.AttendeeExceptions           = null;
            calendarValidationContext.AttendeeDeletions            = null;
            calendarValidationContext.OppositeRoleOrganizerIsValid = false;
            calendarValidationContext.CvsGateway        = cvsGateway;
            calendarValidationContext.AttendeeExtractor = attendeeExtractor;
            return(calendarValidationContext);
        }