Пример #1
0
 protected override void ModifyRequestInternal(TransactionalRequestJob requestJob, StringBuilder changedValuesTracker)
 {
     if (base.IsFieldSet("RemoteSourceMailboxServerLegacyDN"))
     {
         changedValuesTracker.AppendLine(string.Format("RemoteMailboxServerLegacyDN: {0} -> {1}", requestJob.RemoteMailboxServerLegacyDN, this.RemoteSourceMailboxServerLegacyDN));
         requestJob.RemoteMailboxServerLegacyDN = this.RemoteSourceMailboxServerLegacyDN;
     }
     if (base.IsFieldSet("OutlookAnywhereHostName"))
     {
         changedValuesTracker.AppendLine(string.Format("OutlookAnywhereHostName: {0} -> {1}", requestJob.OutlookAnywhereHostName, this.OutlookAnywhereHostName));
         requestJob.OutlookAnywhereHostName = this.OutlookAnywhereHostName;
     }
     if (base.IsFieldSet("RemoteCredential"))
     {
         changedValuesTracker.AppendLine("RemoteCredential: <secure> -> <secure>");
         requestJob.RemoteCredential = RequestTaskHelper.GetNetworkCredential(this.RemoteCredential, requestJob.AuthenticationMethod);
     }
     if (base.IsFieldSet("IsAdministrativeCredential"))
     {
         changedValuesTracker.AppendLine(string.Format("IsAdministrativeCredential: {0} -> {1}", requestJob.IsAdministrativeCredential, this.IsAdministrativeCredential));
         requestJob.IsAdministrativeCredential = new bool?(this.IsAdministrativeCredential);
     }
     if (base.IsFieldSet("StartAfter") && !RequestTaskHelper.CompareUtcTimeWithLocalTime(requestJob.TimeTracker.GetTimestamp(RequestJobTimestamp.StartAfter), this.StartAfter))
     {
         RequestTaskHelper.SetStartAfter(this.StartAfter, requestJob, changedValuesTracker);
     }
     if (base.IsFieldSet("IncrementalSyncInterval"))
     {
         changedValuesTracker.AppendLine(string.Format("IncrementalSyncInterval: {0} -> {1}", requestJob.IncrementalSyncInterval, this.IncrementalSyncInterval));
         requestJob.IncrementalSyncInterval = this.IncrementalSyncInterval;
     }
 }
Пример #2
0
        protected override void ValidateRequest(TransactionalRequestJob requestJob)
        {
            DateTime?timestamp = requestJob.TimeTracker.GetTimestamp(RequestJobTimestamp.StartAfter);
            bool     flag      = RequestTaskHelper.CompareUtcTimeWithLocalTime(timestamp, this.StartAfter);
            bool     flag2     = base.IsFieldSet("StartAfter") && !flag;

            if (flag2)
            {
                this.CheckJobStatusInQueuedForStartAfterSet(requestJob);
            }
            DateTime utcNow = DateTime.UtcNow;

            if (flag2 && this.StartAfter != null)
            {
                RequestTaskHelper.ValidateStartAfterTime(this.StartAfter.Value.ToUniversalTime(), new Task.TaskErrorLoggingDelegate(base.WriteError), utcNow);
            }
            if (base.IsFieldSet("IncrementalSyncInterval"))
            {
                if (requestJob.IncrementalSyncInterval == TimeSpan.Zero || requestJob.JobType < MRSJobType.RequestJobE15_AutoResume)
                {
                    base.WriteError(new IncrementalSyncIntervalCannotBeSetOnNonIncrementalRequestsException(), ErrorCategory.InvalidArgument, this.Identity);
                }
                RequestTaskHelper.ValidateIncrementalSyncInterval(this.IncrementalSyncInterval, new Task.TaskErrorLoggingDelegate(base.WriteError));
            }
            if (base.IsFieldSet("StartAfter") && flag)
            {
                this.WriteWarning(Strings.WarningScheduledTimeIsUnchanged("StartAfter"));
            }
            base.ValidateRequest(requestJob);
        }
Пример #3
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     base.InternalValidate();
     this.targetUser = 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), false);
     TaskLogger.LogExit();
 }
Пример #4
0
 internal void ValidateRequestProtectionStatus(RequestJobBase requestJob)
 {
     if (requestJob.Protect && RequestTaskHelper.CheckUserOrgIdIsTenant(base.ExecutingUserOrganizationId))
     {
         base.WriteError(new RequestIsProtectedPermanentException(requestJob.Name), ErrorCategory.InvalidArgument, this.Identity);
     }
 }
Пример #5
0
 private MailboxDatabase ChooseTargetMailboxDatabase(ADObjectId sourceMailboxDatabase)
 {
     return(RequestTaskHelper.ChooseTargetMDB(new ADObjectId[]
     {
         sourceMailboxDatabase
     }, false, this.mailbox, base.DomainController, base.ScopeSet, new Action <LocalizedString>(base.WriteVerbose), new Action <LocalizedException, ExchangeErrorCategory, object>(base.WriteError), new Action <Exception, ErrorCategory, object>(base.WriteError), this.Mailbox));
 }
        protected override void WriteResult(IConfigurable dataObject)
        {
            TaskLogger.LogEnter(new object[]
            {
                dataObject
            });
            TDataObject tdataObject = (TDataObject)((object)dataObject);

            try
            {
                RequestTaskHelper.GetUpdatedMRSRequestInfo(tdataObject, this.Diagnostic, this.DiagnosticArgument);
                if (tdataObject.Status == RequestStatus.Queued)
                {
                    tdataObject.PositionInQueue = this.rjProvider.ComputePositionInQueue(tdataObject.RequestGuid);
                }
                base.WriteResult(tdataObject);
                if (tdataObject.ValidationResult != RequestJobBase.ValidationResultEnum.Valid)
                {
                    this.WriteWarning(Strings.ErrorInvalidRequest(tdataObject.Identity.ToString(), tdataObject.ValidationMessage));
                }
                if (tdataObject.PoisonCount > 5)
                {
                    this.WriteWarning(Strings.WarningJobIsPoisoned(tdataObject.Identity.ToString(), tdataObject.PoisonCount));
                }
                if (base.ParameterSetName.Equals("MigrationRequestQueue"))
                {
                    base.WriteVerbose(Strings.RawRequestJobDump(CommonUtils.ConfigurableObjectToString(tdataObject)));
                }
            }
            finally
            {
                TaskLogger.LogExit();
            }
        }
Пример #7
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);
     }
 }
Пример #8
0
 protected override void ValidateRequest(TransactionalRequestJob requestJob)
 {
     base.ValidateRequest(requestJob);
     base.ValidateRequestIsActive(requestJob);
     base.ValidateRequestProtectionStatus(requestJob);
     base.ValidateRequestIsRunnable(requestJob);
     base.ValidateRequestIsNotCancelled(requestJob);
     if (!requestJob.Suspend)
     {
         base.WriteVerbose(Strings.RequestNotSuspended(requestJob.Name));
     }
     if (RequestJobStateNode.RequestStateIs(requestJob.StatusDetail, RequestState.Completion) && !RequestJobStateNode.RequestStateIs(requestJob.StatusDetail, RequestState.IncrementalSync))
     {
         base.WriteError(new SuspendWhenReadyToCompleteCannotBeUsedDuringCompletionException(requestJob.Name), ErrorCategory.InvalidArgument, requestJob.Identity);
     }
     using (MailboxReplicationServiceClient mailboxReplicationServiceClient = requestJob.CreateMRSClient(base.ConfigSession, requestJob.WorkItemQueueMdb.ObjectGuid, base.UnreachableMrsServers))
     {
         LocalizedString message = requestJob.Message;
         requestJob.Message = LocalizedString.Empty;
         try
         {
             List <ReportEntry> entries = null;
             using (mailboxReplicationServiceClient.ValidateAndPopulateRequestJob(requestJob, out entries))
             {
                 RequestTaskHelper.WriteReportEntries(requestJob.Name, entries, requestJob.Identity, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning), new Task.TaskErrorLoggingDelegate(base.WriteError));
             }
         }
         finally
         {
             requestJob.Message = message;
         }
     }
 }
 protected override void SetRequestProperties(TransactionalRequestJob dataObject)
 {
     base.SetRequestProperties(dataObject);
     dataObject.JobType      = MRSJobType.RequestJobE15_CreatePublicFoldersUnderParentInSecondary;
     dataObject.RequestType  = MRSRequestType.PublicFolderMailboxMigration;
     dataObject.WorkloadType = base.WorkloadType;
     if (base.ParameterSetName.Equals("MailboxMigrationOutlookAnywherePublicFolder"))
     {
         dataObject.AuthenticationMethod        = new AuthenticationMethod?(this.AuthenticationMethod);
         dataObject.OutlookAnywhereHostName     = this.OutlookAnywhereHostName;
         dataObject.RemoteCredential            = RequestTaskHelper.GetNetworkCredential(this.RemoteCredential, new AuthenticationMethod?(this.AuthenticationMethod));
         dataObject.RemoteMailboxLegacyDN       = this.RemoteMailboxLegacyDN;
         dataObject.RemoteMailboxServerLegacyDN = this.RemoteMailboxServerLegacyDN;
     }
     else
     {
         dataObject.SourceDatabase     = this.sourceDatabase;
         dataObject.SourceExchangeGuid = this.sourceDatabase.ObjectGuid;
     }
     dataObject.PreserveMailboxSignature   = false;
     dataObject.PreventCompletion          = true;
     dataObject.SuspendWhenReadyToComplete = true;
     dataObject.AllowedToFinishMove        = false;
     dataObject.SourceDatabase             = this.sourceDatabase;
     dataObject.TargetDatabase             = base.MdbId;
     dataObject.TargetUserId                 = this.TargetMailboxUser.Id;
     dataObject.ExchangeGuid                 = this.TargetMailboxUser.ExchangeGuid;
     dataObject.TargetExchangeGuid           = this.TargetMailboxUser.ExchangeGuid;
     dataObject.FolderToMailboxMap           = this.folderToMailboxMapping;
     dataObject.AllowLargeItems              = false;
     dataObject.SkipFolderPromotedProperties = true;
     dataObject.SkipFolderViews              = true;
     dataObject.SkipFolderRestrictions       = true;
     dataObject.SkipContentVerification      = true;
 }
Пример #10
0
 protected override void PostSaveAction()
 {
     if (!base.ParameterSetName.Equals("MigrationRequestQueue") && this.requestCondition == RemoveRequest <TIdentity> .RequestCondition.None && this.DataObject != null)
     {
         RequestTaskHelper.TickleMRS(this.DataObject, MoveRequestNotification.Canceled, this.mdbGuid, base.ConfigSession, base.UnreachableMrsServers);
     }
 }
Пример #11
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     try
     {
         base.ValidateRootFolders(this.SourceRootFolder, this.TargetRootFolder);
         if (!this.FilePath.IsUnc)
         {
             base.WriteError(new NonUNCFilePathPermanentException(this.FilePath.PathName), ErrorCategory.InvalidArgument, this.FilePath);
         }
         bool flag  = !OrganizationId.ForestWideOrgId.Equals(base.ExecutingUserOrganizationId);
         bool flag2 = this.RemoteHostName != null;
         if (flag && !flag2)
         {
             base.WriteError(new RemoteMailboxImportNeedRemoteProxyException(), ErrorCategory.InvalidArgument, this);
         }
         this.user = 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);
         bool wildcardedSearch = false;
         if (!string.IsNullOrEmpty(base.Name))
         {
             base.ValidateName();
             base.RequestName = base.Name;
         }
         else
         {
             wildcardedSearch = true;
             base.RequestName = "MailboxImport";
         }
         if (base.ParameterSetName.Equals("MailboxImportRequest"))
         {
             this.DisallowImportForPublicFolderMailbox();
             if (this.user.RecipientType != RecipientType.UserMailbox)
             {
                 base.WriteError(new InvalidRecipientTypePermanentException(this.user.ToString(), this.user.RecipientType.ToString()), ErrorCategory.InvalidArgument, this.Mailbox);
             }
             if (this.IsArchive && (this.user.ArchiveGuid == Guid.Empty || this.user.ArchiveDatabase == null))
             {
                 base.WriteError(new MailboxLacksArchivePermanentException(this.user.ToString()), ErrorCategory.InvalidArgument, this.IsArchive);
             }
             if (!this.IsArchive && this.user.Database == null)
             {
                 base.WriteError(new MailboxLacksDatabasePermanentException(this.user.ToString()), ErrorCategory.InvalidArgument, this.Mailbox);
             }
             base.RescopeToOrgId(this.user.OrganizationId);
             ADObjectId mdbId         = null;
             ADObjectId mdbServerSite = null;
             this.LocateAndChooseMdb(null, this.IsArchive ? this.user.ArchiveDatabase : this.user.Database, null, this.Mailbox, this.Mailbox, out mdbId, out mdbServerSite);
             base.MdbId         = mdbId;
             base.MdbServerSite = mdbServerSite;
             base.Flags         = (RequestFlags.IntraOrg | RequestFlags.Pull);
         }
         base.RequestName = this.CheckRequestNameAvailability(base.RequestName, this.user.Id, true, MRSRequestType.MailboxImport, this.Mailbox, wildcardedSearch);
         base.InternalValidate();
     }
     finally
     {
         TaskLogger.LogExit();
     }
 }
Пример #12
0
 protected override void ValidateRequest(TransactionalRequestJob requestJob)
 {
     if (base.IsFieldSet("IncrementalSyncInterval"))
     {
         RequestTaskHelper.ValidateIncrementalSyncInterval(this.IncrementalSyncInterval, new Task.TaskErrorLoggingDelegate(base.WriteError));
     }
     base.ValidateRequest(requestJob);
 }
Пример #13
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));
 }
Пример #14
0
 protected override void InternalBeginProcessing()
 {
     base.InternalBeginProcessing();
     RequestTaskHelper.ValidateItemLimits(this.BadItemLimit, this.LargeItemLimit, this.AcceptLargeDataLoss, new Task.TaskErrorLoggingDelegate(base.WriteError), new Task.TaskWarningLoggingDelegate(this.WriteWarning), base.ExecutingUserIdentity);
     if (this.BatchName != null && this.BatchName.Length > 255)
     {
         base.WriteError(new ParameterLengthExceededPermanentException("BatchName", 255), ErrorCategory.InvalidArgument, this.BatchName);
     }
 }
Пример #15
0
        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();
            }
        }
 protected override void ModifyRequestInternal(TransactionalRequestJob requestJob, StringBuilder changedValuesTracker)
 {
     base.ModifyRequestInternal(requestJob, changedValuesTracker);
     if (base.IsFieldSet("SkipMoving"))
     {
         RequestJobInternalFlags requestJobInternalFlags = requestJob.RequestJobInternalFlags;
         RequestTaskHelper.SetSkipMoving(this.SkipMoving, requestJob, new Task.TaskErrorLoggingDelegate(base.WriteError), true);
         changedValuesTracker.AppendLine(string.Format("InternalFlags: {0} -> {1}", requestJobInternalFlags, requestJob.RequestJobInternalFlags));
     }
 }
Пример #17
0
 protected override void InternalBeginProcessing()
 {
     base.InternalBeginProcessing();
     if (this.Organization != null)
     {
         IConfigurationSession session = RequestTaskHelper.CreateOrganizationFindingSession(base.CurrentOrganizationId, base.ExecutingUserOrganizationId);
         ADOrganizationalUnit  adorganizationalUnit = (ADOrganizationalUnit)base.GetDataObject <ADOrganizationalUnit>(this.Organization, session, null, new LocalizedString?(Strings.ErrorOrganizationNotFound(this.Organization.ToString())), new LocalizedString?(Strings.ErrorOrganizationNotUnique(this.Organization.ToString())));
         base.CurrentOrganizationId = adorganizationalUnit.OrganizationId;
     }
 }
Пример #18
0
 protected override void SetRequestProperties(TransactionalRequestJob dataObject)
 {
     base.SetRequestProperties(dataObject);
     dataObject.RequestType = MRSRequestType.MailboxImport;
     if (dataObject.WorkloadType == RequestWorkloadType.None)
     {
         if (string.IsNullOrEmpty(this.RemoteHostName))
         {
             dataObject.WorkloadType = RequestWorkloadType.Local;
         }
         else
         {
             dataObject.WorkloadType = RequestWorkloadType.RemotePstIngestion;
         }
     }
     dataObject.ContentCodePage = this.ContentCodePage;
     dataObject.FilePath        = this.FilePath.PathName;
     if (this.user != null)
     {
         dataObject.TargetUserId = this.user.Id;
         dataObject.TargetUser   = this.user;
     }
     if (base.ParameterSetName.Equals("MailboxImportRequest"))
     {
         if (!string.IsNullOrEmpty(this.SourceRootFolder))
         {
             dataObject.SourceRootFolder = this.SourceRootFolder;
         }
         if (!string.IsNullOrEmpty(this.TargetRootFolder))
         {
             dataObject.TargetRootFolder = this.TargetRootFolder;
         }
         if (this.IsArchive)
         {
             dataObject.TargetIsArchive    = true;
             dataObject.TargetExchangeGuid = this.user.ArchiveGuid;
             dataObject.TargetDatabase     = ADObjectIdResolutionHelper.ResolveDN(this.user.ArchiveDatabase);
         }
         else
         {
             dataObject.TargetIsArchive    = false;
             dataObject.TargetExchangeGuid = this.user.ExchangeGuid;
             dataObject.TargetDatabase     = ADObjectIdResolutionHelper.ResolveDN(this.user.Database);
         }
         dataObject.TargetAlias = this.user.Alias;
         if (this.RemoteCredential != null)
         {
             dataObject.RemoteCredential = RequestTaskHelper.GetNetworkCredential(this.RemoteCredential, null);
         }
         if (!string.IsNullOrEmpty(this.RemoteHostName))
         {
             dataObject.RemoteHostName = this.RemoteHostName;
         }
     }
 }
Пример #19
0
 private void SetSkipMergingAndInternalFlags(TransactionalRequestJob dataObject)
 {
     RequestTaskHelper.SetSkipMerging(this.SkipMerging, dataObject, new Task.TaskErrorLoggingDelegate(base.WriteError));
     RequestTaskHelper.SetInternalFlags(this.InternalFlags, dataObject, new Task.TaskErrorLoggingDelegate(base.WriteError));
     if (this.SkipMerging == null)
     {
         using (SettingsContextBase.ActivateContext(dataObject))
         {
             dataObject.SkipKnownCorruptions = ConfigBase <MRSConfigSchema> .GetConfig <bool>("SkipKnownCorruptionsDefault");
         }
     }
 }
Пример #20
0
 protected override void ModifyRequestInternal(TransactionalRequestJob requestJob, StringBuilder changedValuesTracker)
 {
     if (base.IsFieldSet("RemoteServerName"))
     {
         changedValuesTracker.AppendLine(string.Format("RemoteServerName: {0} -> {1}", requestJob.RemoteHostName, this.RemoteServerName));
         requestJob.RemoteHostName = this.RemoteServerName;
     }
     if (base.IsFieldSet("RemoteServerPort"))
     {
         changedValuesTracker.AppendLine(string.Format("RemoteServerPort: {0} -> {1}", requestJob.RemoteHostPort, this.RemoteServerPort));
         requestJob.RemoteHostPort = this.RemoteServerPort;
     }
     if (base.IsFieldSet("SmtpServerName"))
     {
         changedValuesTracker.AppendLine(string.Format("SmtpServerName: {0} -> {1}", requestJob.SmtpServerName, this.SmtpServerName));
         requestJob.SmtpServerName = this.SmtpServerName;
     }
     if (base.IsFieldSet("SmtpServerPort"))
     {
         changedValuesTracker.AppendLine(string.Format("SmtpServerPort: {0} -> {1}", requestJob.SmtpServerPort, this.SmtpServerPort));
         requestJob.SmtpServerPort = this.SmtpServerPort;
     }
     if (base.IsFieldSet("Authentication"))
     {
         changedValuesTracker.AppendLine(string.Format("Authentication: {0} -> {1}", requestJob.AuthenticationMethod, this.Authentication));
         requestJob.AuthenticationMethod = new AuthenticationMethod?(this.Authentication);
     }
     if (base.IsFieldSet("Security"))
     {
         changedValuesTracker.AppendLine(string.Format("Security: {0} -> {1}", requestJob.SecurityMechanism, this.Security));
         requestJob.SecurityMechanism = this.Security;
     }
     if (base.IsFieldSet("Password"))
     {
         changedValuesTracker.AppendLine("Password: <secure> -> <secure>");
         PSCredential psCred = new PSCredential(requestJob.RemoteCredential.UserName, this.Password);
         requestJob.RemoteCredential = RequestTaskHelper.GetNetworkCredential(psCred, requestJob.AuthenticationMethod);
     }
     if (base.IsFieldSet("IncrementalSyncInterval"))
     {
         changedValuesTracker.AppendLine(string.Format("IncrementalSyncInterval: {0} -> {1}", requestJob.IncrementalSyncInterval, this.IncrementalSyncInterval));
         requestJob.IncrementalSyncInterval = this.IncrementalSyncInterval;
     }
     if (base.IsFieldSet("StartAfter") && !RequestTaskHelper.CompareUtcTimeWithLocalTime(requestJob.TimeTracker.GetTimestamp(RequestJobTimestamp.StartAfter), this.StartAfter))
     {
         RequestTaskHelper.SetStartAfter(this.StartAfter, requestJob, changedValuesTracker);
     }
     if (base.IsFieldSet("CompleteAfter") && !RequestTaskHelper.CompareUtcTimeWithLocalTime(requestJob.TimeTracker.GetTimestamp(RequestJobTimestamp.CompleteAfter), this.CompleteAfter))
     {
         RequestTaskHelper.SetCompleteAfter(this.CompleteAfter, requestJob, changedValuesTracker);
     }
 }
Пример #21
0
 protected override void SetRequestProperties(TransactionalRequestJob dataObject)
 {
     base.SetRequestProperties(dataObject);
     dataObject.RequestType = MRSRequestType.MailboxRestore;
     if (dataObject.WorkloadType == RequestWorkloadType.None)
     {
         dataObject.WorkloadType = RequestWorkloadType.Local;
     }
     if (this.targetUser != null)
     {
         dataObject.TargetUserId = this.targetUser.Id;
         dataObject.TargetUser   = this.targetUser;
     }
     if (!string.IsNullOrEmpty(this.SourceRootFolder))
     {
         dataObject.SourceRootFolder = this.SourceRootFolder;
     }
     dataObject.SourceIsArchive     = false;
     dataObject.SourceExchangeGuid  = this.sourceMailboxGuid;
     dataObject.SourceDatabase      = this.sourceDatabase;
     dataObject.MailboxRestoreFlags = new MailboxRestoreType?(this.restoreFlags);
     if (!string.IsNullOrEmpty(this.TargetRootFolder))
     {
         dataObject.TargetRootFolder = this.TargetRootFolder;
     }
     if (this.TargetIsArchive)
     {
         dataObject.TargetIsArchive    = true;
         dataObject.TargetExchangeGuid = this.targetUser.ArchiveGuid;
         dataObject.TargetDatabase     = ADObjectIdResolutionHelper.ResolveDN(this.targetUser.ArchiveDatabase);
     }
     else
     {
         dataObject.TargetIsArchive    = false;
         dataObject.TargetExchangeGuid = this.targetUser.ExchangeGuid;
         dataObject.TargetDatabase     = ADObjectIdResolutionHelper.ResolveDN(this.targetUser.Database);
     }
     dataObject.TargetAlias         = this.targetUser.Alias;
     dataObject.AllowedToFinishMove = true;
     if (this.IsPublicFolderMailboxRestore)
     {
         dataObject.SkipFolderRules = true;
     }
     if (base.ParameterSetName.Equals("RemoteMailboxRestore"))
     {
         dataObject.RemoteDatabaseGuid = new Guid?(this.RemoteDatabaseGuid);
         dataObject.RemoteHostName     = this.RemoteHostName;
         dataObject.RemoteCredential   = RequestTaskHelper.GetNetworkCredential(this.RemoteCredential, new AuthenticationMethod?(AuthenticationMethod.WindowsIntegrated));
     }
 }
Пример #22
0
 protected override void ModifyRequestInternal(TransactionalRequestJob requestJob, StringBuilder changedValuesTracker)
 {
     if (base.IsFieldSet("RemoteCredential"))
     {
         changedValuesTracker.AppendLine("RemoteCredential: <secure> -> <secure>");
         requestJob.RemoteCredential = RequestTaskHelper.GetNetworkCredential(this.RemoteCredential, null);
     }
     if (base.IsFieldSet("RemoteHostName"))
     {
         changedValuesTracker.AppendLine(string.Format("RemoteHostName: {0} -> {1}", requestJob.RemoteHostName, this.RemoteHostName));
         requestJob.RemoteHostName = this.RemoteHostName;
     }
     base.ModifyRequestInternal(requestJob, changedValuesTracker);
 }
Пример #23
0
        protected override void TranslateException(ref Exception e, out ErrorCategory category)
        {
            LocalizedException ex = RequestTaskHelper.TranslateExceptionHandler(e);

            if (ex == null)
            {
                ErrorCategory errorCategory;
                base.TranslateException(ref e, out errorCategory);
                category = errorCategory;
                return;
            }
            e        = ex;
            category = ErrorCategory.ResourceUnavailable;
        }
Пример #24
0
 protected override void ModifyRequestInternal(TransactionalRequestJob requestJob, StringBuilder changedValuesTracker)
 {
     if (base.IsFieldSet("SuspendWhenReadyToComplete"))
     {
         changedValuesTracker.AppendLine(string.Format("SWRTC: {0} -> {1}", requestJob.SuspendWhenReadyToComplete, this.SuspendWhenReadyToComplete));
         requestJob.SuspendWhenReadyToComplete = this.SuspendWhenReadyToComplete;
     }
     if (base.IsFieldSet("CompleteAfter") && !RequestTaskHelper.CompareUtcTimeWithLocalTime(requestJob.TimeTracker.GetTimestamp(RequestJobTimestamp.CompleteAfter), this.CompleteAfter))
     {
         RequestTaskHelper.SetCompleteAfter(this.CompleteAfter, requestJob, changedValuesTracker);
     }
     if (base.IsFieldSet("IncrementalSyncInterval"))
     {
         requestJob.IncrementalSyncInterval = this.IncrementalSyncInterval;
     }
 }
Пример #25
0
 protected override void ModifyRequestInternal(TransactionalRequestJob requestJob, StringBuilder changedValuesTracker)
 {
     if (base.IsFieldSet("RemoteCredential"))
     {
         string arg  = (requestJob.RemoteCredential == null) ? null : requestJob.RemoteCredential.UserName;
         string arg2 = (this.RemoteCredential == null) ? null : this.RemoteCredential.UserName;
         changedValuesTracker.AppendLine(string.Format("UserName of RemoteCredential: {0} -> {1}", arg, arg2));
         requestJob.RemoteCredential = RequestTaskHelper.GetNetworkCredential(this.RemoteCredential, null);
     }
     if (base.IsFieldSet("RemoteHostName"))
     {
         changedValuesTracker.AppendLine(string.Format("RemoteHostName: {0} -> {1}", requestJob.RemoteHostName, this.RemoteHostName));
         requestJob.RemoteHostName = this.RemoteHostName;
     }
     base.ModifyRequestInternal(requestJob, changedValuesTracker);
 }
        protected override void WriteResult(IConfigurable dataObject)
        {
            TaskLogger.LogEnter(new object[]
            {
                dataObject
            });
            MoveRequestStatistics moveRequestStatistics = (MoveRequestStatistics)dataObject;

            try
            {
                RequestTaskHelper.GetUpdatedMRSRequestInfo(moveRequestStatistics, this.Diagnostic, this.DiagnosticArgument);
                if (moveRequestStatistics.Status == RequestStatus.Queued)
                {
                    moveRequestStatistics.PositionInQueue = this.mrProvider.ComputePositionInQueue(moveRequestStatistics.ExchangeGuid);
                }
                base.WriteResult(moveRequestStatistics);
                string identity;
                if (moveRequestStatistics.UserId != null)
                {
                    identity = moveRequestStatistics.UserId.ToString();
                }
                else if (moveRequestStatistics.Identity != null)
                {
                    identity = moveRequestStatistics.Identity.ToString();
                }
                else
                {
                    identity = moveRequestStatistics.ExchangeGuid.ToString();
                }
                if (moveRequestStatistics.ValidationResult != RequestJobBase.ValidationResultEnum.Valid)
                {
                    this.WriteWarning(Strings.ErrorInvalidMoveRequest(identity, moveRequestStatistics.ValidationMessage));
                }
                if (moveRequestStatistics.PoisonCount > 5)
                {
                    this.WriteWarning(Strings.WarningJobIsPoisoned(identity, moveRequestStatistics.PoisonCount));
                }
                if (base.ParameterSetName.Equals("MigrationMoveRequestQueue"))
                {
                    base.WriteVerbose(Strings.RawRequestJobDump(CommonUtils.ConfigurableObjectToString(moveRequestStatistics)));
                }
            }
            finally
            {
                TaskLogger.LogExit();
            }
        }
Пример #27
0
 protected override void InternalBeginProcessing()
 {
     base.InternalBeginProcessing();
     if (base.IsFieldSet("CompleteAfter") && base.IsFieldSet("SuspendWhenReadyToComplete"))
     {
         DateTime?completeAfter = base.IsFieldSet("CompleteAfter") ? new DateTime?(this.CompleteAfter) : null;
         RequestTaskHelper.ValidateStartAfterCompleteAfterWithSuspendWhenReadyToComplete(null, completeAfter, this.SuspendWhenReadyToComplete.ToBool(), new Task.TaskErrorLoggingDelegate(base.WriteError));
     }
     if (base.IsFieldSet("IncrementalSyncInterval") && base.IsFieldSet("SuspendWhenReadyToComplete") && this.SuspendWhenReadyToComplete.ToBool())
     {
         base.WriteError(new SuspendWhenReadyToCompleteCannotBeSetWithIncrementalSyncIntervalException(), ErrorCategory.InvalidArgument, this.SuspendWhenReadyToComplete);
     }
     if (base.IsFieldSet("IncrementalSyncInterval"))
     {
         RequestTaskHelper.ValidateIncrementalSyncInterval(this.IncrementalSyncInterval, new Task.TaskErrorLoggingDelegate(base.WriteError));
     }
 }
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     base.InternalValidate();
     if (this.TargetMailbox != null)
     {
         ADUser aduser = RequestTaskHelper.ResolveADUser(base.RecipSession, base.GCSession, base.ServerSettings, this.TargetMailbox, base.OptionalIdentityData, base.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), false);
         this.targetUserId = aduser.Id;
     }
     if (this.SourceDatabase != null)
     {
         this.SourceDatabase.AllowLegacy = true;
         MailboxDatabase mailboxDatabase = (MailboxDatabase)base.GetDataObject <MailboxDatabase>(this.SourceDatabase, base.ConfigSession, null, new LocalizedString?(Strings.ErrorDatabaseNotFound(this.SourceDatabase.ToString())), new LocalizedString?(Strings.ErrorDatabaseNotUnique(this.SourceDatabase.ToString())));
         this.sourceDatabaseId = mailboxDatabase.Id;
     }
     TaskLogger.LogExit();
 }
Пример #29
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));
 }
Пример #30
0
 protected override void InternalBeginProcessing()
 {
     base.InternalBeginProcessing();
     RequestTaskHelper.ValidateItemLimits(this.BadItemLimit, this.LargeItemLimit, this.AcceptLargeDataLoss, new Task.TaskErrorLoggingDelegate(base.WriteError), new Task.TaskWarningLoggingDelegate(this.WriteWarning), base.ExecutingUserIdentity);
     if (this.BatchName != null && this.BatchName.Length > 255)
     {
         base.WriteError(new ParameterLengthExceededPermanentException("BatchName", 255), ErrorCategory.InvalidArgument, this.BatchName);
     }
     if (this.TargetDatabase != null)
     {
         this.specifiedTargetMDB = this.LocateAndVerifyMdb(this.TargetDatabase, out this.newTargetServerVersion);
     }
     if (this.ArchiveTargetDatabase != null)
     {
         this.specifiedArchiveTargetMDB = this.LocateAndVerifyMdb(this.ArchiveTargetDatabase, out this.newArchiveTargetServerVersion);
     }
 }