コード例 #1
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter(new object[]
     {
         this.DataObject
     });
     try
     {
         base.InternalValidate();
         TransactionalRequestJob dataObject = this.DataObject;
         if (base.IsFieldSet("TargetDatabase"))
         {
             ServerVersion serverVersion = new ServerVersion(MapiUtils.FindServerForMdb(dataObject.TargetDatabase.ObjectGuid, null, null, FindServerFlags.None).ServerVersion);
             if (this.newTargetServerVersion.Major != serverVersion.Major || this.newTargetServerVersion.Minor != serverVersion.Minor)
             {
                 base.WriteError(new RecipientTaskException(Strings.ErrorCannotRetargetToDifferentVersionServerThanOriginal(this.newTargetServerVersion.ToString(), serverVersion.ToString())), ErrorCategory.InvalidArgument, base.Identity);
             }
         }
         if (base.IsFieldSet("ArchiveTargetDatabase"))
         {
             ServerVersion serverVersion2 = new ServerVersion(MapiUtils.FindServerForMdb(dataObject.TargetArchiveDatabase.ObjectGuid, null, null, FindServerFlags.None).ServerVersion);
             if (this.newArchiveTargetServerVersion.Major != serverVersion2.Major || this.newArchiveTargetServerVersion.Minor != serverVersion2.Minor)
             {
                 base.WriteError(new RecipientTaskException(Strings.ErrorCannotRetargetToDifferentVersionArchiveServerThanOriginal(this.newArchiveTargetServerVersion.ToString(), serverVersion2.ToString())), ErrorCategory.InvalidArgument, base.Identity);
             }
         }
     }
     finally
     {
         TaskLogger.LogExit();
     }
 }
コード例 #2
0
        private void RetrieveTargetMailboxInformation()
        {
            if (base.IsFieldSet("TargetDatabase"))
            {
                this.targetMailboxDatabase = (MailboxDatabase)base.GetDataObject <MailboxDatabase>(this.TargetDatabase, base.ConfigSession, null, new LocalizedString?(Strings.ErrorDatabaseNotFound(this.TargetDatabase.ToString())), new LocalizedString?(Strings.ErrorDatabaseNotUnique(this.TargetDatabase.ToString())));
                MailboxTaskHelper.VerifyDatabaseIsWithinScopeForRecipientCmdlets(base.ConfigSession.SessionSettings, this.targetMailboxDatabase, new Task.ErrorLoggerDelegate(base.WriteError));
            }
            else
            {
                this.targetMailboxDatabase = this.ChooseTargetMailboxDatabase(this.mailbox.Database);
            }
            DatabaseInformation value = MapiUtils.FindServerForMdb(this.targetMailboxDatabase.Id.ObjectGuid, null, null, FindServerFlags.None);

            this.targetDatabaseInformation = new DatabaseInformation?(value);
            if (!this.IsSupportedDatabaseVersion(value.ServerVersion, NewRequest <MailboxRelocationRequest> .DatabaseSide.Target))
            {
                base.WriteError(new DatabaseVersionUnsupportedPermanentException(this.targetMailboxDatabase.Identity.ToString(), value.ServerFqdn, new ServerVersion(value.ServerVersion).ToString()), ErrorCategory.InvalidArgument, this.Mailbox);
            }
            if (this.targetMailboxDatabase.Recovery)
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorTargetDatabaseIsRecovery(this.targetMailboxDatabase.ToString())), ErrorCategory.InvalidArgument, this.Mailbox);
            }
            if (this.mailbox.MailboxProvisioningConstraint != null && this.targetMailboxDatabase.MailboxProvisioningAttributes != null && !this.mailbox.MailboxProvisioningConstraint.IsMatch(this.targetMailboxDatabase.MailboxProvisioningAttributes))
            {
                base.WriteError(new MailboxConstraintsMismatchException(this.mailbox.ToString(), this.targetMailboxDatabase.Name, this.mailbox.MailboxProvisioningConstraint.Value), ErrorCategory.InvalidData, this.Mailbox);
            }
        }
コード例 #3
0
 protected override void ModifyRequest(TransactionalRequestJob requestJob)
 {
     base.ModifyRequest(requestJob);
     if (base.IsFieldSet("SourceDatabase"))
     {
         PublicFolderDatabase publicFolderDatabase = (PublicFolderDatabase)base.GetDataObject <PublicFolderDatabase>(this.SourceDatabase, base.ConfigSession, null, new LocalizedString?(Strings.ErrorDatabaseNotFound(this.SourceDatabase.ToString())), new LocalizedString?(Strings.ErrorDatabaseNotUnique(this.SourceDatabase.ToString())));
         DatabaseInformation  databaseInformation  = MapiUtils.FindServerForMdb(publicFolderDatabase.Id.ObjectGuid, null, null, FindServerFlags.None);
         if (!this.IsSupportedDatabaseVersion(databaseInformation.ServerVersion))
         {
             base.WriteError(new DatabaseVersionUnsupportedPermanentException(publicFolderDatabase.Identity.ToString(), databaseInformation.ServerFqdn, new ServerVersion(databaseInformation.ServerVersion).ToString()), ErrorCategory.InvalidArgument, null);
         }
         requestJob.SourceDatabase = publicFolderDatabase.Id;
     }
     if (base.IsFieldSet("RemoteMailboxLegacyDN"))
     {
         requestJob.RemoteMailboxLegacyDN = this.RemoteMailboxLegacyDN;
     }
     if (base.IsFieldSet("RemoteMailboxServerLegacyDN"))
     {
         requestJob.RemoteMailboxServerLegacyDN = this.RemoteMailboxServerLegacyDN;
     }
     if (base.IsFieldSet("OutlookAnywhereHostName"))
     {
         requestJob.OutlookAnywhereHostName = this.OutlookAnywhereHostName;
     }
     if (base.IsFieldSet("AuthenticationMethod"))
     {
         requestJob.AuthenticationMethod = new AuthenticationMethod?(this.AuthenticationMethod);
     }
     if (base.IsFieldSet("RemoteCredential"))
     {
         requestJob.RemoteCredential = RequestTaskHelper.GetNetworkCredential(this.RemoteCredential, requestJob.AuthenticationMethod);
     }
 }
コード例 #4
0
 private void RetrieveSourceMailboxInformation()
 {
     this.mailbox = RequestTaskHelper.ResolveADUser(base.RecipSession, base.GCSession, base.ServerSettings, this.Mailbox, base.OptionalIdentityData, base.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), true);
     if (this.mailbox.Database == null)
     {
         base.WriteError(new MailboxLacksDatabasePermanentException(this.mailbox.ToString()), ErrorCategory.InvalidArgument, this.Mailbox);
     }
     this.sourceDatabaseInformation = new DatabaseInformation?(MapiUtils.FindServerForMdb(this.mailbox.Database.ObjectGuid, null, null, FindServerFlags.None));
 }
コード例 #5
0
        private MailboxDatabase LocateAndVerifyMdb(DatabaseIdParameter databaseId, out ServerVersion targetServerVersion)
        {
            MailboxDatabase     mailboxDatabase     = (MailboxDatabase)base.GetDataObject <MailboxDatabase>(databaseId, base.ConfigSession, null, new LocalizedString?(Strings.ErrorMailboxDatabaseNotFound(databaseId.ToString())), new LocalizedString?(Strings.ErrorMailboxDatabaseNotUnique(databaseId.ToString())));
            DatabaseInformation databaseInformation = MapiUtils.FindServerForMdb(mailboxDatabase.Id.ObjectGuid, null, null, FindServerFlags.None);

            targetServerVersion = new ServerVersion(databaseInformation.ServerVersion);
            this.EnsureSupportedServerVersion(databaseInformation.ServerVersion);
            return(mailboxDatabase);
        }
コード例 #6
0
 private void ChooseTargetMailboxDatabase(TransactionalRequestJob dataObject)
 {
     if (this.targetContainer != null)
     {
         dataObject.TargetDatabase         = ADObjectIdResolutionHelper.ResolveDN(this.targetContainer.Database);
         dataObject.TargetContainerGuid    = this.targetContainer.MailboxContainerGuid;
         dataObject.TargetUnifiedMailboxId = this.targetContainer.GetCrossTenantObjectId();
     }
     else if (this.targetMailboxDatabase != null)
     {
         dataObject.TargetDatabase      = ADObjectIdResolutionHelper.ResolveDN(this.targetMailboxDatabase.Id);
         this.targetDatabaseInformation = new DatabaseInformation?(MapiUtils.FindServerForMdb(this.targetMailboxDatabase.Id.ObjectGuid, null, null, FindServerFlags.None));
     }
     dataObject.TargetVersion = this.targetDatabaseInformation.Value.ServerVersion;
 }
コード例 #7
0
ファイル: NewRequest.cs プロジェクト: YHZX2013/exchange_diff
        protected T CheckDatabase <T>(DatabaseIdParameter databaseIdParameter, NewRequest <TRequest> .DatabaseSide databaseSide, object errorObject, out string serverName, out string serverDN, out ADObjectId serverSite, out int serverVersion) where T : Database, new()
        {
            T result = (T)((object)base.GetDataObject <T>(databaseIdParameter, this.ConfigSession, null, new LocalizedString?(Strings.ErrorDatabaseNotFound(databaseIdParameter.ToString())), new LocalizedString?(Strings.ErrorDatabaseNotUnique(databaseIdParameter.ToString()))));
            DatabaseInformation databaseInformation = MapiUtils.FindServerForMdb(result.Id.ObjectGuid, null, null, FindServerFlags.None);

            serverName    = databaseInformation.ServerFqdn;
            serverDN      = databaseInformation.ServerDN;
            serverSite    = databaseInformation.ServerSite;
            serverVersion = databaseInformation.ServerVersion;
            if (!this.IsSupportedDatabaseVersion(serverVersion, databaseSide))
            {
                base.WriteError(new DatabaseVersionUnsupportedPermanentException(result.Identity.ToString(), serverName, new ServerVersion(serverVersion).ToString()), ErrorCategory.InvalidArgument, errorObject);
            }
            return(result);
        }
コード例 #8
0
 private void RetrieveTargetContainerAndMailboxInformation()
 {
     this.targetContainer = RequestTaskHelper.ResolveADUser(base.RecipSession, base.GCSession, base.ServerSettings, this.TargetContainer, base.OptionalIdentityData, base.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), true);
     if (this.targetContainer.UnifiedMailbox != null)
     {
         base.WriteError(new MailboxRelocationJoinTargetNotContainerOwnerException(this.targetContainer.ToString()), ErrorCategory.InvalidArgument, this.TargetContainer);
     }
     if (this.targetContainer.MailboxContainerGuid == null)
     {
         base.WriteError(new MailboxRelocationJoinTargetNotContainerException(this.targetContainer.ToString()), ErrorCategory.InvalidArgument, this.TargetContainer);
     }
     if (this.targetContainer.Database == null)
     {
         base.WriteError(new MailboxLacksDatabasePermanentException(this.targetContainer.ToString()), ErrorCategory.InvalidArgument, this.TargetContainer);
     }
     this.targetDatabaseInformation = new DatabaseInformation?(MapiUtils.FindServerForMdb(this.targetContainer.Database.ObjectGuid, null, null, FindServerFlags.None));
 }