Beispiel #1
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));
        }