private void ValidateNoOtherActiveRequests() { string otherRequests = MailboxRequestIndexEntryHandler.GetOtherRequests(this.mailbox, null); if (!string.IsNullOrEmpty(otherRequests)) { base.WriteError(new ObjectInvolvedInMultipleRelocationsPermanentException(MrsStrings.Mailbox, otherRequests), ErrorCategory.InvalidArgument, this.Mailbox); } ADRecipient adrecipient; if (this.mailbox.UnifiedMailbox != null && ADRecipient.TryGetFromCrossTenantObjectId(this.mailbox.UnifiedMailbox, out adrecipient).Succeeded) { otherRequests = MailboxRequestIndexEntryHandler.GetOtherRequests((ADUser)adrecipient, null); if (!string.IsNullOrEmpty(otherRequests)) { base.WriteError(new ObjectInvolvedInMultipleRelocationsPermanentException(MrsStrings.SourceContainer, otherRequests), ErrorCategory.InvalidArgument, this.Mailbox); } } if (this.targetContainer != null) { otherRequests = MailboxRequestIndexEntryHandler.GetOtherRequests(this.targetContainer, null); if (!string.IsNullOrEmpty(otherRequests)) { base.WriteError(new ObjectInvolvedInMultipleRelocationsPermanentException(MrsStrings.TargetContainer, otherRequests), ErrorCategory.InvalidArgument, this.Mailbox); } } }
protected override void InternalValidate() { TaskLogger.LogEnter(); try { if (!string.IsNullOrEmpty(base.Name)) { base.ValidateName(); base.RequestName = base.Name; } else { base.RequestName = base.ParameterSetName; } this.RetrieveSourceMailboxInformation(); base.RescopeToOrgId(this.mailbox.OrganizationId); string parameterSetName; if ((parameterSetName = base.ParameterSetName) != null) { ADObjectId mdbId; ADObjectId mdbServerSite; RequestFlags requestFlags; if (!(parameterSetName == "MailboxRelocationJoin")) { if (!(parameterSetName == "MailboxRelocationSplit")) { goto IL_135; } if (this.mailbox.UnifiedMailbox == null || !ADRecipient.TryGetFromCrossTenantObjectId(this.mailbox.UnifiedMailbox, out this.sourceContainer).Succeeded) { base.WriteError(new MailboxRelocationSplitSourceNotInContainerException(this.mailbox.ToString()), ErrorCategory.InvalidArgument, this.Mailbox); } this.RetrieveTargetMailboxInformation(); requestFlags = this.LocateAndChooseMdb(this.mailbox.Database, this.targetMailboxDatabase.Id, this.Mailbox, this.TargetDatabase, this.TargetDatabase, out mdbId, out mdbServerSite); } else { this.RetrieveTargetContainerAndMailboxInformation(); requestFlags = this.LocateAndChooseMdb(this.mailbox.Database, this.targetContainer.Database, this.Mailbox, this.TargetContainer, this.TargetContainer, out mdbId, out mdbServerSite); } this.moveFlags |= requestFlags; base.MdbId = mdbId; base.MdbServerSite = mdbServerSite; base.Flags = this.moveFlags; RequestTaskHelper.ValidateNotImplicitSplit(this.moveFlags, this.mailbox, new Task.TaskErrorLoggingDelegate(base.WriteError), this.Mailbox); this.ValidateNoOtherActiveRequests(); base.InternalValidate(); return; } IL_135: throw new NotImplementedException(); } finally { TaskLogger.LogExit(); } }
private static bool ValidateNoOtherRequests(RequestJobBase requestJobBase) { IEnumerable <RequestIndexId> source = from i in requestJobBase.IndexEntries select i.RequestIndexId into i where i.Location == RequestIndexLocation.Mailbox select i; if (source.Any((RequestIndexId i) => i.Mailbox.Equals(requestJobBase.UserId))) { string otherRequests = MailboxRequestIndexEntryHandler.GetOtherRequests(requestJobBase.User, new Guid?(requestJobBase.RequestGuid)); if (!string.IsNullOrEmpty(otherRequests)) { requestJobBase.ValidationResult = new RequestJobBase.ValidationResultEnum?(RequestJobBase.ValidationResultEnum.DataMismatch); requestJobBase.ValidationMessage = MrsStrings.ValidationObjectInvolvedInMultipleRelocations(MrsStrings.Mailbox, otherRequests); return(false); } } if (requestJobBase.User.UnifiedMailbox != null) { ADRecipient tempRecipient; if (ADRecipient.TryGetFromCrossTenantObjectId(requestJobBase.User.UnifiedMailbox, out tempRecipient).Succeeded&& source.Any((RequestIndexId i) => i.Mailbox.Equals(tempRecipient.Id))) { string otherRequests = MailboxRequestIndexEntryHandler.GetOtherRequests((ADUser)tempRecipient, new Guid?(requestJobBase.RequestGuid)); if (!string.IsNullOrEmpty(otherRequests)) { requestJobBase.ValidationResult = new RequestJobBase.ValidationResultEnum?(RequestJobBase.ValidationResultEnum.DataMismatch); requestJobBase.ValidationMessage = MrsStrings.ValidationObjectInvolvedInMultipleRelocations(MrsStrings.SourceContainer, otherRequests); return(false); } } } if (requestJobBase.TargetUnifiedMailboxId != null) { ADRecipient tempRecipient; if (ADRecipient.TryGetFromCrossTenantObjectId(requestJobBase.TargetUnifiedMailboxId, out tempRecipient).Succeeded&& source.Any((RequestIndexId i) => i.Mailbox.Equals(tempRecipient.Id))) { string otherRequests = MailboxRequestIndexEntryHandler.GetOtherRequests((ADUser)tempRecipient, new Guid?(requestJobBase.RequestGuid)); if (!string.IsNullOrEmpty(otherRequests)) { requestJobBase.ValidationResult = new RequestJobBase.ValidationResultEnum?(RequestJobBase.ValidationResultEnum.DataMismatch); requestJobBase.ValidationMessage = MrsStrings.ValidationObjectInvolvedInMultipleRelocations(MrsStrings.TargetContainer, otherRequests); return(false); } } } return(true); }