Esempio n. 1
0
 protected override IConfigDataProvider CreateSession()
 {
     MigrationLogger.Initialize();
     MigrationLogContext.Current.Source       = "Get-MigrationUser";
     MigrationLogContext.Current.Organization = base.CurrentOrganizationId.OrganizationalUnit;
     return(MigrationUserDataProvider.CreateDataProvider(this.Action, base.TenantGlobalCatalogSession, this.partitionMailbox, null));
 }
        protected override void InternalProcessRecord()
        {
            base.InternalProcessRecord();
            MigrationUserDataProvider migrationUserDataProvider = (MigrationUserDataProvider)base.DataSession;

            MigrationObjectTaskBase <MigrationBatchIdParameter> .RegisterMigrationBatch(this, migrationUserDataProvider.MailboxSession, base.CurrentOrganizationId, false, false);
        }
        protected override void InternalValidate()
        {
            base.InternalValidate();
            MigrationUserDataProvider migrationUserDataProvider = (MigrationUserDataProvider)base.DataSession;

            migrationUserDataProvider.ForceRemoval = this.Force;
            MigrationJob job = migrationUserDataProvider.GetJob(this.DataObject.BatchId);

            if (job != null && job.MigrationType == MigrationType.PublicFolder)
            {
                base.WriteError(new CannotRemoveMigrationUserFromPublicFolderBatchException());
            }
            if (this.Force)
            {
                return;
            }
            if (job == null)
            {
                base.WriteError(new CannotRemoveUserWithoutBatchException(this.DataObject.Identity.ToString()));
            }
            LocalizedString?localizedString;

            if (!job.IsPAW && !job.SupportsRemovingUsers(out localizedString))
            {
                base.WriteError(new CannotRemoveMigrationUserOnCurrentStateException(this.Identity.ToString(), job.JobName));
            }
        }
        protected override void WriteResult(IConfigurable dataObject)
        {
            base.WriteResult(dataObject);
            MigrationUserDataProvider migrationUserDataProvider = base.DataSession as MigrationUserDataProvider;

            if (migrationUserDataProvider != null && migrationUserDataProvider.LastError != null)
            {
                this.WriteWarning(Strings.MigrationUserSubscriptionInaccessible(dataObject.Identity.ToString(), migrationUserDataProvider.LastError.LocalizedString));
            }
        }
        protected override IConfigDataProvider CreateSession()
        {
            MigrationLogger.Initialize();
            MigrationLogContext.Current.Source       = "Get-MigrationUserStatistics";
            MigrationLogContext.Current.Organization = base.CurrentOrganizationId.OrganizationalUnit;
            IConfigDataProvider result;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                MigrationUserDataProvider migrationUserDataProvider = MigrationUserDataProvider.CreateDataProvider(this.Action, base.TenantGlobalCatalogSession, this.partitionMailbox, null);
                disposeGuard.Add <MigrationUserDataProvider>(migrationUserDataProvider);
                migrationUserDataProvider.LimitSkippedItemsTo = this.LimitSkippedItemsTo;
                migrationUserDataProvider.IncludeReport       = this.IncludeReport;
                if (base.Diagnostic || !string.IsNullOrEmpty(base.DiagnosticArgument))
                {
                    migrationUserDataProvider.EnableDiagnostics(base.DiagnosticArgument);
                }
                disposeGuard.Success();
                result = migrationUserDataProvider;
            }
            return(result);
        }