private void CheckAnomaly(ConsistencyCheckResult result, AnomaliesFlags existingAnomalies, AnomaliesFlags anomaly) { if (anomaly != AnomaliesFlags.None && (existingAnomalies & anomaly) != AnomaliesFlags.None) { result.Status = CheckStatusType.Failed; result.AddInconsistency(base.Context, Inconsistency.CreateInstance(RoleType.Attendee, anomaly.ToString(), CalendarInconsistencyFlag.RecurrenceAnomaly, base.Context)); } }
private void FailCheck(ConsistencyCheckResult result, RoleType checkingRole, UserObject checkingUser, RecurrenceFormatException exception) { result.Status = CheckStatusType.Failed; string text = string.Format("RecurrenceBlobsConsistentCheck: RecurrenceFormatException for {0} ({1}), exception = {2}", checkingRole, checkingUser, exception.GetType()); Globals.ConsistencyChecksTracer.TraceError((long)this.GetHashCode(), text); if (checkingRole == RoleType.Attendee) { result.AddInconsistency(base.Context, Inconsistency.CreateInstance(RoleType.Attendee, text, CalendarInconsistencyFlag.RecurrenceBlob, base.Context)); } }
private PrimaryConsistencyCheckResult GetResult(ICollection <StoreObjectValidationError> errorList) { PrimaryConsistencyCheckResult primaryConsistencyCheckResult = PrimaryConsistencyCheckResult.CreateInstance(base.Type, base.Description, true); if (errorList != null && errorList.Count != 0) { primaryConsistencyCheckResult.Status = CheckStatusType.Failed; foreach (StoreObjectValidationError storeObjectValidationError in errorList) { primaryConsistencyCheckResult.AddInconsistency(base.Context, Inconsistency.CreateInstance(base.Context.BaseRole, storeObjectValidationError.ToString(), CalendarInconsistencyFlag.StoreObjectValidation, base.Context)); } } return(primaryConsistencyCheckResult); }
private bool CheckFoundItem(CalendarFolder folder, CalendarItemBase item, MeetingExistenceConsistencyCheckResult result, string itemQueryError) { bool flag = false; if (item != null) { CalendarItemType calendarItemType = base.Context.BaseItem.CalendarItemType; CalendarItemType calendarItemType2 = item.CalendarItemType; if ((calendarItemType == CalendarItemType.Single || calendarItemType == CalendarItemType.RecurringMaster) && (calendarItemType2 == CalendarItemType.Occurrence || calendarItemType2 == CalendarItemType.Exception)) { result.ItemIsFound = false; string description = string.Format("Item type mismatch. [BaseType|BaseGoid - FoundType|FoundGoid] ({0}|{1} - {2}|{3})", new object[] { calendarItemType, base.Context.BaseItem.GlobalObjectId, calendarItemType2, item.GlobalObjectId }); this.FailCheck(result, this.GetInconsistencyFullDescription(description, itemQueryError)); flag = true; } else { result.ItemIsFound = true; } } else { result.ItemIsFound = false; if (this.FailOnAbsence) { string description2 = string.Format("Could not find the matching meeting in {0}'s calendar.", base.Context.OppositeRole.ToString().ToLower()); try { string inconsistencyFullDescription = this.GetInconsistencyFullDescription(description2, itemQueryError); this.FailCheck(result, base.Context.CalendarInstance.GetInconsistency(base.Context, inconsistencyFullDescription)); } catch (CalendarVersionStoreNotPopulatedException ex) { this.FailCheck(result, Inconsistency.CreateInstance(base.Context.OppositeRole, string.Format("The Calendar Version Store is not fully populated yet (Wait Time: {0}).", ex.WaitTimeBeforeThrow), CalendarInconsistencyFlag.MissingCvs, base.Context)); } flag = true; } } return(!flag); }
private void RegisterStorageException(ConsistencyCheckResult result, LocalizedException exception) { result.Status = CheckStatusType.CheckError; result.AddInconsistency(base.Context, Inconsistency.CreateInstance(RoleType.Organizer, exception.ToString(), CalendarInconsistencyFlag.StorageException, base.Context)); }
private void FailCheck(ConsistencyCheckResult result, RoleType inconsistentRole, CalendarInconsistencyFlag flag, string fullDescription) { result.Status = CheckStatusType.Failed; result.AddInconsistency(base.Context, Inconsistency.CreateInstance(inconsistentRole, fullDescription, flag, base.Context)); }
internal static Inconsistency CreateMissingCvsInconsistency(RoleType owner, CalendarVersionStoreNotPopulatedException exc, CalendarValidationContext context) { return(Inconsistency.CreateInstance(owner, string.Format("The Calendar Version Store is not fully populated yet (Wait Time: {0}).", exc.WaitTimeBeforeThrow), CalendarInconsistencyFlag.MissingCvs, context)); }
internal override void ValidateMeetings(ref Dictionary <GlobalObjectId, List <Attendee> > organizerRumsSent, Action <long> onItemRepaired) { bool shouldProcessMailbox = CalendarParticipant.InternalShouldProcessMailbox(this.ExchangePrincipal); try { List <SearchExpressionType> list = new List <SearchExpressionType>(); foreach (CalendarInstanceContext calendarInstanceContext in base.ItemList.Values) { calendarInstanceContext.ValidationContext.CalendarInstance = new CalendarRemoteItem(this.ExchangePrincipal, this.binding); calendarInstanceContext.ValidationContext.CalendarInstance.ShouldProcessMailbox = shouldProcessMailbox; GlobalObjectId globalObjectId = calendarInstanceContext.ValidationContext.BaseItem.GlobalObjectId; string value = Convert.ToBase64String(globalObjectId.CleanGlobalObjectIdBytes); SearchExpressionType item = new IsEqualToType { Item = CalendarItemFields.CleanGlobalObjectIdProp, FieldURIOrConstant = new FieldURIOrConstantType { Item = new ConstantValueType { Value = value } } }; list.Add(item); } ItemType[] remoteCalendarItems = this.GetRemoteCalendarItems(list); if (remoteCalendarItems != null) { Dictionary <GlobalObjectId, CalendarItemType> dictionary = new Dictionary <GlobalObjectId, CalendarItemType>(); foreach (ItemType itemType in remoteCalendarItems) { CalendarItemType calendarItemType = itemType as CalendarItemType; GlobalObjectId globalObjectId2 = CalendarItemFields.GetGlobalObjectId(calendarItemType); dictionary.Add(globalObjectId2, calendarItemType); } foreach (KeyValuePair <GlobalObjectId, CalendarInstanceContext> keyValuePair in base.ItemList) { if (dictionary.ContainsKey(keyValuePair.Key)) { CalendarItemType remoteItem = dictionary[keyValuePair.Key]; CalendarInstanceContext value2 = keyValuePair.Value; try { try { CalendarItemBase calendarItemBase = CalendarItem.Create(this.localSession, this.localSession.GetDefaultFolderId(DefaultFolderType.Calendar)); Globals.ConsistencyChecksTracer.TraceDebug((long)this.GetHashCode(), "Converting the EWS item to XSO."); this.calendarConverter.ConvertItem(calendarItemBase, remoteItem); value2.ValidationContext.OppositeItem = calendarItemBase; } catch (FormatException ex) { string text = string.Format("Could not convert the remote item, exception = {0}", ex.GetType()); Globals.ConsistencyChecksTracer.TraceError((long)this.GetHashCode(), text); value2.ValidationContext.CalendarInstance.LoadInconsistency = Inconsistency.CreateInstance(value2.ValidationContext.OppositeRole, text, CalendarInconsistencyFlag.StorageException, value2.ValidationContext); } catch (CorruptDataException ex2) { string text2 = string.Format("Could not convert the remote item, exception = {0}", ex2.GetType()); Globals.ConsistencyChecksTracer.TraceError((long)this.GetHashCode(), text2); value2.ValidationContext.CalendarInstance.LoadInconsistency = Inconsistency.CreateInstance(value2.ValidationContext.OppositeRole, text2, CalendarInconsistencyFlag.StorageException, value2.ValidationContext); } catch (StorageTransientException ex3) { string text3 = string.Format("Could not convert the remote item, exception = {0}", ex3.GetType()); Globals.ConsistencyChecksTracer.TraceError((long)this.GetHashCode(), text3); value2.ValidationContext.CalendarInstance.LoadInconsistency = Inconsistency.CreateInstance(value2.ValidationContext.OppositeRole, text3, CalendarInconsistencyFlag.StorageException, value2.ValidationContext); } continue; } finally { base.ValidateInstance(value2, organizerRumsSent, onItemRepaired); if (value2.ValidationContext.OppositeItem != null) { value2.ValidationContext.OppositeItem.Dispose(); value2.ValidationContext.OppositeItem = null; } } } Globals.ConsistencyChecksTracer.TraceDebug((long)this.GetHashCode(), "GetItem didn't return an expected GlobalObjectId."); } } foreach (CalendarInstanceContext calendarInstanceContext2 in base.ItemList.Values) { if (!calendarInstanceContext2.IsValidationDone) { if (calendarInstanceContext2.ValidationContext.OppositeRole == RoleType.Organizer && calendarInstanceContext2.ValidationContext.OppositeItem == null) { calendarInstanceContext2.ValidationContext.OppositeRoleOrganizerIsValid = true; } base.ValidateInstance(calendarInstanceContext2, organizerRumsSent, onItemRepaired); } } } catch (ProtocolViolationException exception) { this.HandleRemoteException(exception); } catch (SecurityException exception2) { this.HandleRemoteException(exception2); } catch (ArgumentException exception3) { this.HandleRemoteException(exception3); } catch (InvalidOperationException exception4) { this.HandleRemoteException(exception4); } catch (NotSupportedException exception5) { this.HandleRemoteException(exception5); } catch (XmlException exception6) { this.HandleRemoteException(exception6); } catch (XPathException exception7) { this.HandleRemoteException(exception7); } catch (SoapException exception8) { this.HandleRemoteException(exception8); } catch (IOException exception9) { this.HandleRemoteException(exception9); } }
internal override void ValidateMeetings(ref Dictionary <GlobalObjectId, List <Attendee> > organizerRumsSent, Action <long> onItemRepaired) { bool shouldProcessMailbox = CalendarParticipant.InternalShouldProcessMailbox(this.ExchangePrincipal); SessionManager.SessionData sessionData = this.sessionManager[this.ExchangePrincipal]; foreach (CalendarInstanceContext calendarInstanceContext in base.ItemList.Values) { string empty = string.Empty; CalendarLocalItem calendarLocalItem = new CalendarLocalItem(this.ExchangePrincipal, sessionData.Session); calendarInstanceContext.ValidationContext.CalendarInstance = calendarLocalItem; calendarInstanceContext.ValidationContext.CalendarInstance.ShouldProcessMailbox = shouldProcessMailbox; try { using (CalendarFolder calendarFolder = CalendarFolder.Bind(sessionData.Session, DefaultFolderType.Calendar, null)) { calendarLocalItem.CalendarFolderId = calendarFolder.Id.ObjectId.ProviderLevelItemId; CalendarItemBase calendarItemBase = CalendarQuery.FindMatchingItem(sessionData.Session, calendarFolder, calendarInstanceContext.ValidationContext.BaseItem.CalendarItemType, calendarInstanceContext.ValidationContext.BaseItem.GlobalObjectId.Bytes, ref empty); if (calendarInstanceContext.ValidationContext.OppositeRole == RoleType.Organizer) { if (calendarItemBase != null) { calendarInstanceContext.ValidationContext.OppositeRoleOrganizerIsValid = calendarItemBase.IsOrganizer(); } else { calendarInstanceContext.ValidationContext.OppositeRoleOrganizerIsValid = this.IsOrganizerValid(sessionData.Session, calendarInstanceContext); } calendarInstanceContext.ValidationContext.OppositeItem = (calendarInstanceContext.ValidationContext.OppositeRoleOrganizerIsValid ? calendarItemBase : null); } else { calendarInstanceContext.ValidationContext.OppositeItem = calendarItemBase; } calendarInstanceContext.ValidationContext.ErrorString = empty; } } catch (StorageTransientException ex) { string text = string.Format("Could not open item store session or calendar, exception = {0}", ex.GetType()); Globals.ConsistencyChecksTracer.TraceError((long)this.GetHashCode(), text); calendarInstanceContext.ValidationContext.CalendarInstance.LoadInconsistency = Inconsistency.CreateInstance(calendarInstanceContext.ValidationContext.OppositeRole, text, CalendarInconsistencyFlag.StorageException, calendarInstanceContext.ValidationContext); } catch (RecurrenceFormatException ex2) { string text2 = string.Format("Could not open item store session or calendar due recurrence format error, exception = {0}", ex2.GetType()); Globals.ConsistencyChecksTracer.TraceError((long)this.GetHashCode(), text2); calendarInstanceContext.ValidationContext.CalendarInstance.LoadInconsistency = ((calendarInstanceContext.ValidationContext.OppositeRole == RoleType.Attendee) ? Inconsistency.CreateInstance(calendarInstanceContext.ValidationContext.OppositeRole, text2, CalendarInconsistencyFlag.RecurrenceBlob, calendarInstanceContext.ValidationContext) : null); } catch (StoragePermanentException ex3) { string text3 = string.Format("Could not open item store session or calendar, exception = {0}", ex3.GetType()); Globals.ConsistencyChecksTracer.TraceError((long)this.GetHashCode(), text3); calendarInstanceContext.ValidationContext.CalendarInstance.LoadInconsistency = Inconsistency.CreateInstance(calendarInstanceContext.ValidationContext.OppositeRole, text3, CalendarInconsistencyFlag.StorageException, calendarInstanceContext.ValidationContext); } catch (ArgumentException arg) { Globals.ConsistencyChecksTracer.TraceError <RoleType, ArgumentException>((long)this.GetHashCode(), "Could not open item store session or calendar for {0}, exception = {1}", calendarInstanceContext.ValidationContext.OppositeRole, arg); } finally { base.ValidateInstance(calendarInstanceContext, organizerRumsSent, onItemRepaired); if (calendarInstanceContext.ValidationContext.OppositeItem != null) { calendarInstanceContext.ValidationContext.OppositeItem.Dispose(); calendarInstanceContext.ValidationContext.OppositeItem = null; } } } }