protected override void InternalValidate() { base.InternalValidate(); if (this.Identity == null && this.Server == null) { this.Server = MailboxServerIdParameter.Parse(Environment.MachineName); } MailboxServerIdParameter mailboxServerIdParameter = null; if (this.Server != null) { mailboxServerIdParameter = this.Server; } else if (this.Local) { mailboxServerIdParameter = MailboxServerIdParameter.Parse(Environment.MachineName); } if (mailboxServerIdParameter != null) { this.m_server = (Server)base.GetDataObject <Server>(mailboxServerIdParameter, base.DataSession, null, new LocalizedString?(Strings.ErrorMailboxServerNotFound(mailboxServerIdParameter.ToString())), new LocalizedString?(Strings.ErrorMailboxServerNotUnique(mailboxServerIdParameter.ToString()))); if (base.HasErrors || this.m_server == null) { base.WriteError(new CouldNotFindServerObject(mailboxServerIdParameter.ToString()), ErrorCategory.InvalidOperation, mailboxServerIdParameter); return; } if (!this.m_server.IsE14OrLater) { base.WriteError(new InvalidOperationException(Strings.ErrorServerNotE14OrLater(mailboxServerIdParameter.ToString())), ErrorCategory.InvalidOperation, mailboxServerIdParameter); } if (!this.m_server.IsMailboxServer) { base.WriteError(this.m_server.GetServerRoleError(ServerRole.Mailbox), ErrorCategory.InvalidOperation, mailboxServerIdParameter); return; } string arg = (this.Identity == null) ? "*" : this.Identity.DatabaseName; string text = string.Format("{0}{1}{2}", arg, '\\', this.m_server.Name); if (this.Identity != null && !string.IsNullOrEmpty(this.Identity.ServerName) && this.Identity.ServerName != "*") { this.WriteWarning(Strings.GetDbcsOverridingServer(this.Identity.ServerName, this.m_server.Name, text)); } this.Identity = DatabaseCopyIdParameter.Parse(text); } this.rootId = new DatabasesContainer().Id; QueryFilter queryFilter = new OrFilter(new QueryFilter[] { new NotFilter(new ExistsFilter(DatabaseCopySchema.ParentObjectClass)), new TextFilter(DatabaseCopySchema.ParentObjectClass, MailboxDatabase.MostDerivedClass, MatchOptions.FullString, MatchFlags.IgnoreCase) }); if (Datacenter.IsMicrosoftHostedOnly(true)) { queryFilter = QueryFilter.OrTogether(new QueryFilter[] { queryFilter, new TextFilter(DatabaseCopySchema.ParentObjectClass, PublicFolderDatabase.MostDerivedClass, MatchOptions.FullString, MatchFlags.IgnoreCase) }); } this.Identity.SetAdditionalQueryFilter(queryFilter); this.Identity.AllowInvalid = true; }
private void ResolveParameters() { if (this.CommandType == MoveActiveMailboxDatabase.CommandTypes.MoveAwayFromServer) { this.m_sourceServer = (Server)base.GetDataObject <Server>(this.Server, base.DataSession, null, new LocalizedString?(Strings.ErrorMailboxServerNotFound(this.Server.ToString())), new LocalizedString?(Strings.ErrorMailboxServerNotUnique(this.Server.ToString()))); if (this.m_sourceServer == null) { base.WriteError(new InvalidOperationException(Strings.ServerNotFound(this.Server.ToString())), ErrorCategory.InvalidData, this.Server.ToString()); } this.m_sourceAmServer = new AmServerName(this.m_sourceServer); } MailboxServerIdParameter mailboxServerIdParameter = null; if (this.TargetServerSpecified) { mailboxServerIdParameter = this.ActivateOnServer; } else if (this.CommandType == MoveActiveMailboxDatabase.CommandTypes.MoveBackToServer) { mailboxServerIdParameter = this.ActivatePreferredOnServer; } if (mailboxServerIdParameter != null) { this.m_targetServer = (Server)base.GetDataObject <Server>(mailboxServerIdParameter, base.DataSession, null, new LocalizedString?(Strings.ErrorMailboxServerNotFound(mailboxServerIdParameter.ToString())), new LocalizedString?(Strings.ErrorMailboxServerNotUnique(mailboxServerIdParameter.ToString()))); if (this.m_targetServer == null) { base.WriteError(new InvalidOperationException(Strings.ServerNotFound(mailboxServerIdParameter.ToString())), ErrorCategory.InvalidData, mailboxServerIdParameter); } this.m_targetAmServer = new AmServerName(this.m_targetServer); } }