Example #1
0
        private MeetingInquiryAction TryReviveMeeting(CalendarItemBase deletedVersion)
        {
            bool flag = false;

            if (this.GlobalObjectId.IsCleanGlobalObjectId)
            {
                using (CalendarItemBase calendarItemBase = (CalendarItemBase)Microsoft.Exchange.Data.Storage.Item.CloneItem(base.Session, this.MailboxSession.GetDefaultFolderId(DefaultFolderType.Calendar), deletedVersion, false, true, null))
                {
                    calendarItemBase.LocationIdentifierHelperInstance.SetLocationIdentifier(43287U, LastChangeAction.Resurrect);
                    calendarItemBase.Save(SaveMode.NoConflictResolution);
                    flag = true;
                    goto IL_207;
                }
            }
            using (CalendarFolder calendarFolder = CalendarFolder.Bind(this.MailboxSession, DefaultFolderType.Calendar))
            {
                StoreId calendarItemId = calendarFolder.GetCalendarItemId(this.GlobalObjectId.CleanGlobalObjectIdBytes);
                if (calendarItemId != null)
                {
                    using (CalendarItem calendarItem = CalendarItem.Bind(this.MailboxSession, calendarItemId))
                    {
                        if (calendarItem.CalendarItemType == CalendarItemType.RecurringMaster)
                        {
                            try
                            {
                                calendarItem.RecoverDeletedOccurrenceByDateId(this.GlobalObjectId.Date);
                                calendarItem.LocationIdentifierHelperInstance.SetLocationIdentifier(59671U, LastChangeAction.Resurrect);
                                ConflictResolutionResult conflictResolutionResult = calendarItem.Save(SaveMode.ResolveConflicts);
                                if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
                                {
                                    ExTraceGlobals.MeetingMessageTracer.TraceError <string, GlobalObjectId>((long)this.GetHashCode(), "Storage.MeetingInquiryMessage::ReviveDeletedVersionIfNoCancellation for Mailbox {0} and GOID {1} hit a save conflict.", this.MailboxSession.DisplayName, this.GlobalObjectId);
                                    throw new SaveConflictException(ServerStrings.ExSaveFailedBecauseOfConflicts(base.InternalObjectId), conflictResolutionResult);
                                }
                                flag = true;
                            }
                            catch (OccurrenceNotFoundException)
                            {
                                ExTraceGlobals.MeetingMessageTracer.TraceError <string, GlobalObjectId, ExDateTime>((long)this.GetHashCode(), "Storage.MeetingInquiryMessage::ReviveDeletedVersionIfNoCancellation for Mailbox {0} and GOID {1}. There's no occurrence on {2}", this.MailboxSession.DisplayName, this.GlobalObjectId, this.GlobalObjectId.Date);
                            }
                            catch (ObjectValidationException ex)
                            {
                                if (ex.Errors.Count != 1 || (!(ex.Errors[0].Constraint is OrganizerPropertiesConstraint) && !(ex.Errors[0].Constraint is CalendarOriginatorIdConstraint)))
                                {
                                    throw;
                                }
                                ExTraceGlobals.MeetingMessageTracer.TraceError <string, GlobalObjectId, string>((long)this.GetHashCode(), "Storage.MeetingInquiryMessage::ReviveDeletedVersionIfNoCancellation for Mailbox {0} and GOID {1}. Object validation failed : {2}", this.MailboxSession.DisplayName, this.GlobalObjectId, ex.Message);
                            }
                        }
                        goto IL_1FB;
                    }
                }
                ExTraceGlobals.MeetingMessageTracer.TraceError <string, byte[]>((long)this.GetHashCode(), "Storage.MeetingInquiryMessage::ReviveDeletedVersionIfNoCancellation for Mailbox {0}. Couldn't find calendar item with CGOID {1}", this.MailboxSession.DisplayName, this.GlobalObjectId.CleanGlobalObjectIdBytes);
                IL_1FB :;
            }
            IL_207 :
            if (!flag)
            {
                return(MeetingInquiryAction.FailedToRevive);
            }
            return(MeetingInquiryAction.ReviveMeeting);
        }