// Token: 0x06000F81 RID: 3969 RVA: 0x0005BDD8 File Offset: 0x00059FD8
        public bool IsSplitNeeded()
        {
            bool result = false;
            Unlimited <ByteQuantifiedSize> mailboxQuota = PublicFolderSplitHelper.GetMailboxQuota(this.logger, this.powershellFactory, this.publicFolderSession.MailboxGuid, this.publicFolderSession.OrganizationId, null);
            Unlimited <ByteQuantifiedSize> unlimited    = ByteQuantifiedSize.Zero;
            Unlimited <ByteQuantifiedSize> unlimited2   = ByteQuantifiedSize.Zero;

            if (!mailboxQuota.IsUnlimited)
            {
                Unlimited <ByteQuantifiedSize> totalItemSize;
                unlimited = (totalItemSize = PublicFolderSplitHelper.GetTotalItemSize(this.logger, this.powershellFactory, this.publicFolderSession.MailboxGuid, this.publicFolderSession.OrganizationId, null));
                if (totalItemSize.Value.ToBytes() >= mailboxQuota.Value.ToBytes() * PublicFolderSplitConfig.Instance.SplitThreshold / 100UL)
                {
                    Unlimited <ByteQuantifiedSize> actualItemSize;
                    unlimited2 = (actualItemSize = PublicFolderSplitHelper.GetActualItemSize(this.logger, this.powershellFactory, this.publicFolderSession.MailboxGuid, this.publicFolderSession.OrganizationId, null));
                    if (actualItemSize.Value.ToBytes() >= mailboxQuota.Value.ToBytes() * PublicFolderSplitConfig.Instance.SplitThreshold / 100UL)
                    {
                        result = true;
                    }
                }
            }
            this.logger.LogEvent(LogEventType.Statistics, string.Format("IsSplitNeeded={0},MailboxQuota={1},TotalItemSize={2},ActualItemSize={3}", new object[]
            {
                result.ToString(),
                mailboxQuota.ToString(),
                unlimited.ToString(),
                unlimited2.ToString()
            }));
            return(result);
        }
        // Token: 0x06000F5E RID: 3934 RVA: 0x0005B7C4 File Offset: 0x000599C4
        private void SyncPublicFolderMailbox(Guid mailboxGuid)
        {
            if (PublicFolderSplitHelper.IsPrimaryHierarchy(mailboxGuid, base.CurrentPublicFolderSession.OrganizationId))
            {
                this.logger.LogEvent(LogEventType.Verbose, string.Format("The target mailbox, {0}, is the primary hierarchy. Skipping PrepareTargetMailboxOperation.", this.splitState.TargetMailboxGuid.ToString()));
                return;
            }
            bool flag  = false;
            bool flag2 = PublicFolderSplitHelper.IsSyncRequired(mailboxGuid, base.CurrentPublicFolderSession.OrganizationId, out flag, this.xsoFactory, this.logger);

            if (flag2)
            {
                if (flag)
                {
                    this.SyncAndReturn(mailboxGuid);
                }
                else
                {
                    PublicFolderSplitHelper.SyncAndWaitForCompletion(mailboxGuid, base.CurrentPublicFolderSession.OrganizationId, this.xsoFactory, this.logger, this.splitOperationState);
                }
            }
            this.logger.LogEvent(LogEventType.Statistics, string.Format("PrepareTargetMailboxOperation::SyncPublicFolderMailbox - SR={0},IPS={1},PSC={2},RC={3}", new object[]
            {
                flag2,
                this.splitOperationState.PartialStep,
                this.splitOperationState.PartialStepCount,
                this.splitOperationState.RetryCount
            }));
        }
示例#3
0
        // Token: 0x06000F1C RID: 3868 RVA: 0x0005A544 File Offset: 0x00058744
        public static void PowerShellExceptionHandler(PublicFolderSplitHelper.PowerShellMethod method, ISplitOperationState splitOperationState)
        {
            if (splitOperationState == null)
            {
                PublicFolderSplitHelper.PowerShellExceptionHandler(method);
                return;
            }
            ErrorRecord errorRecord  = null;
            string      errorDetails = null;

            try
            {
                method(out errorDetails, out errorRecord);
            }
            catch (ParameterBindingException error)
            {
                splitOperationState.Error        = error;
                splitOperationState.ErrorDetails = errorDetails;
            }
            catch (CmdletInvocationException error2)
            {
                splitOperationState.Error        = error2;
                splitOperationState.ErrorDetails = errorDetails;
            }
            if (errorRecord != null)
            {
                splitOperationState.Error        = errorRecord.Exception;
                splitOperationState.ErrorDetails = errorDetails;
            }
        }
        // Token: 0x06000EC7 RID: 3783 RVA: 0x00057A38 File Offset: 0x00055C38
        protected override void InvokeInternal()
        {
            if (!this.AreSplitPlanFoldersValid())
            {
                this.splitOperationState.Error = new SplitPlanFoldersInvalidException();
                return;
            }
            PublicFolderMoveRequest publicFolderMoveRequest = this.GetPublicFolderMoveRequest();

            if (this.splitOperationState.Error == null && this.TryHandleExistingRequest(publicFolderMoveRequest))
            {
                Unlimited <ByteQuantifiedSize> totalItemSize = PublicFolderSplitHelper.GetTotalItemSize(this.logger, this.powershellFactory, this.splitState.TargetMailboxGuid, base.CurrentPublicFolderSession.OrganizationId, this.splitOperationState);
                if (this.splitOperationState.Error != null)
                {
                    return;
                }
                Unlimited <ByteQuantifiedSize> mailboxQuota = PublicFolderSplitHelper.GetMailboxQuota(this.logger, this.powershellFactory, this.splitState.TargetMailboxGuid, base.CurrentPublicFolderSession.OrganizationId, this.splitOperationState);
                if (this.splitOperationState.Error != null)
                {
                    return;
                }
                if (totalItemSize.Value.ToBytes() + this.splitState.SplitPlan.TotalSizeToSplit >= mailboxQuota.Value.ToBytes() * PublicFolderSplitConfig.Instance.SplitThreshold / 100UL)
                {
                    this.splitOperationState.Error = new TargetMailboxOutofQuotaException(base.CurrentPublicFolderSession.OrganizationId.OrganizationalUnit.Name, this.splitState.TargetMailboxGuid.ToString());
                    return;
                }
                try
                {
                    if (!PublicFolderSplitHelper.IsPrimaryHierarchy(this.splitState.TargetMailboxGuid, base.CurrentPublicFolderSession.OrganizationId))
                    {
                        bool flag  = false;
                        bool flag2 = PublicFolderSplitHelper.IsSyncRequired(this.splitState.TargetMailboxGuid, base.CurrentPublicFolderSession.OrganizationId, out flag, this.xsoFactory, this.logger);
                        if (flag2)
                        {
                            PublicFolderSplitHelper.SyncAndWaitForCompletion(this.splitState.TargetMailboxGuid, base.CurrentPublicFolderSession.OrganizationId, this.xsoFactory, this.logger, this.splitOperationState);
                        }
                    }
                    else
                    {
                        this.logger.LogEvent(LogEventType.Verbose, string.Format("The target mailbox, {0}, is the primary hierarchy. Skipped sync.", this.splitState.TargetMailboxGuid.ToString()));
                    }
                }
                catch (StorageTransientException error)
                {
                    this.splitOperationState.Error = error;
                    return;
                }
                catch (StoragePermanentException error2)
                {
                    this.splitOperationState.Error = error2;
                    return;
                }
                this.IssueMoveRequest();
                if (this.splitOperationState.Error == null)
                {
                    this.splitOperationState.PartialStep = true;
                    this.logger.LogEvent(LogEventType.Verbose, "MoveContentOperation::InvokeInternal - Successfully issued a new public folder move request.");
                }
            }
        }
示例#5
0
        // Token: 0x06000F19 RID: 3865 RVA: 0x0005A248 File Offset: 0x00058448
        public static void SyncAndWaitForCompletion(Guid mailboxGuid, OrganizationId organizationId, IXSOFactory xsoFactory, IPublicFolderMailboxLoggerBase logger, ISplitOperationState splitOperationState)
        {
            ExchangePrincipal contentMailboxPrincipal;

            if (!PublicFolderSession.TryGetPublicFolderMailboxPrincipal(organizationId, mailboxGuid, false, out contentMailboxPrincipal))
            {
                throw new ObjectNotFoundException(ServerStrings.PublicFolderMailboxNotFound);
            }
            PublicFolderSyncJobState publicFolderSyncJobState = PublicFolderSyncJobRpc.StartSyncHierarchy(contentMailboxPrincipal, true);
            int num = 0;

            while (publicFolderSyncJobState.JobStatus != PublicFolderSyncJobState.Status.Completed && publicFolderSyncJobState.LastError == null && (double)num++ < PublicFolderSplitConfig.Instance.TimeoutForSynchronousOperation.TotalMilliseconds / PublicFolderSplitConfig.Instance.QuerySyncStatusInterval.TotalMilliseconds)
            {
                Thread.Sleep(PublicFolderSplitConfig.Instance.QuerySyncStatusInterval.Milliseconds);
                publicFolderSyncJobState = PublicFolderSyncJobRpc.QueryStatusSyncHierarchy(contentMailboxPrincipal);
            }
            bool flag;

            if (publicFolderSyncJobState.JobStatus != PublicFolderSyncJobState.Status.Completed || PublicFolderSplitHelper.IsSyncRequired(mailboxGuid, organizationId, out flag, xsoFactory, logger))
            {
                splitOperationState.Error = new SyncInProgressException(organizationId.OrganizationalUnit.Name, mailboxGuid.ToString());
                return;
            }
            if (PublicFolderSplitHelper.HasSyncFailure(publicFolderSyncJobState))
            {
                splitOperationState.Error = publicFolderSyncJobState.LastError;
            }
        }
        // Token: 0x06000ECF RID: 3791 RVA: 0x00058444 File Offset: 0x00056644
        private void RemovePublicFolderMoveRequest(PublicFolderMoveRequest moveRequest)
        {
            string    value = base.CurrentPublicFolderSession.OrganizationId.OrganizationalUnit.Name + "\\" + moveRequest.RequestGuid.ToString();
            PSCommand cmd   = new PSCommand();

            cmd.AddCommand("Remove-PublicFolderMoveRequest");
            cmd.AddParameter("Identity", value);
            PublicFolderSplitHelper.PowerShellExceptionHandler(delegate(out string originOfException, out ErrorRecord error)
            {
                originOfException = "MoveContentOperation::RemovePublicFolderMoveRequest - RunPSCommand - Remove-PublicFolderMoveRequest";
                IAssistantRunspaceProxy assistantRunspaceProxy = this.powershellFactory.CreateRunspaceForDatacenterAdmin(this.CurrentPublicFolderSession.OrganizationId);
                assistantRunspaceProxy.RunPSCommand <PublicFolderMoveRequest>(cmd, out error, this.logger);
            }, this.splitOperationState);
        }
        // Token: 0x06000ECE RID: 3790 RVA: 0x0005836C File Offset: 0x0005656C
        private PublicFolderMoveRequest GetPublicFolderMoveRequest()
        {
            PSCommand cmd = new PSCommand();

            cmd.AddCommand("Get-PublicFolderMoveRequest");
            cmd.AddParameter("Organization", base.CurrentPublicFolderSession.OrganizationId.OrganizationalUnit.Name);
            PublicFolderMoveRequest moveRequest = null;

            PublicFolderSplitHelper.PowerShellExceptionHandler(delegate(out string originOfException, out ErrorRecord error)
            {
                originOfException = "MoveContentOperation::GetPublicFolderMoveRequest - RunPSCommand - Get-PublicFolderMoveRequest";
                IAssistantRunspaceProxy assistantRunspaceProxy = this.powershellFactory.CreateRunspaceForDatacenterAdmin(this.CurrentPublicFolderSession.OrganizationId);
                moveRequest = assistantRunspaceProxy.RunPSCommand <PublicFolderMoveRequest>(cmd, out error, this.logger);
            }, this.splitOperationState);
            return(moveRequest);
        }
        // Token: 0x06000ECD RID: 3789 RVA: 0x00058250 File Offset: 0x00056450
        private void ResetIsExcludedFromServingHierarchy()
        {
            string    value = base.CurrentPublicFolderSession.OrganizationId.OrganizationalUnit.Name + "\\" + this.splitState.TargetMailboxGuid.ToString();
            PSCommand cmd   = new PSCommand();

            cmd.AddCommand("Set-Mailbox");
            cmd.AddParameter("PublicFolder");
            cmd.AddParameter("Identity", value);
            cmd.AddParameter("IsExcludedFromServingHierarchy", false);
            PublicFolderSplitHelper.PowerShellExceptionHandler(delegate(out string originOfException, out ErrorRecord error)
            {
                originOfException = "MoveContentOperation::ResetIsExcludedFromServingHierarchy - RunPSCommand - Set-Mailbox";
                IAssistantRunspaceProxy assistantRunspaceProxy = this.powershellFactory.CreateRunspaceForDatacenterAdmin(this.CurrentPublicFolderSession.OrganizationId);
                assistantRunspaceProxy.RunPSCommand <Mailbox>(cmd, out error, this.logger);
            }, this.splitOperationState);
        }
示例#9
0
        // Token: 0x06000E96 RID: 3734 RVA: 0x000577BC File Offset: 0x000559BC
        private bool CanReusePreviousTargetMailbox()
        {
            bool result = false;

            if (this.splitState.PreviousSplitJobState != null && this.splitState.PreviousSplitJobState.OverallSplitState != null && this.splitState.PreviousSplitJobState.OverallSplitState.Error != null)
            {
                Guid targetMailboxGuid = this.splitState.PreviousSplitJobState.TargetMailboxGuid;
                Unlimited <ByteQuantifiedSize> totalItemSize = PublicFolderSplitHelper.GetTotalItemSize(this.logger, this.powershellFactory, this.splitState.PreviousSplitJobState.TargetMailboxGuid, base.CurrentPublicFolderSession.OrganizationId, this.splitOperationState);
                Unlimited <ByteQuantifiedSize> mailboxQuota  = PublicFolderSplitHelper.GetMailboxQuota(this.logger, this.powershellFactory, this.splitState.PreviousSplitJobState.TargetMailboxGuid, base.CurrentPublicFolderSession.OrganizationId, this.splitOperationState);
                if (totalItemSize.Value.ToBytes() <= mailboxQuota.Value.ToBytes() * PublicFolderSplitConfig.Instance.MaxTargetOccupiedThreshold / 100UL)
                {
                    result = true;
                }
            }
            return(result);
        }
        // Token: 0x06000ED0 RID: 3792 RVA: 0x00058534 File Offset: 0x00056734
        private PublicFolderMoveRequestStatistics GetPublicFolderMoveRequestStatistics(PublicFolderMoveRequest moveRequest, bool includeReport)
        {
            PSCommand cmd = new PSCommand();

            cmd.AddCommand("Get-PublicFolderMoveRequestStatistics");
            cmd.AddParameter("Identity", moveRequest.Identity);
            if (includeReport)
            {
                cmd.AddParameter("IncludeReport");
            }
            PublicFolderMoveRequestStatistics moveRequestStats = null;

            PublicFolderSplitHelper.PowerShellExceptionHandler(delegate(out string originOfException, out ErrorRecord error)
            {
                originOfException = "MoveContentOperation::GetPublicFolderMoveRequestStatistics - RunPSCommand - Get-PublicFolderMoveRequestStatistics";
                IAssistantRunspaceProxy assistantRunspaceProxy = this.powershellFactory.CreateRunspaceForDatacenterAdmin(this.CurrentPublicFolderSession.OrganizationId);
                moveRequestStats = assistantRunspaceProxy.RunPSCommand <PublicFolderMoveRequestStatistics>(cmd, out error, this.logger);
            }, this.splitOperationState);
            return(moveRequestStats);
        }
示例#11
0
        // Token: 0x06000E97 RID: 3735 RVA: 0x00057914 File Offset: 0x00055B14
        private Mailbox CreatePublicFolderMailbox()
        {
            string    value = IdentifyTargetMailboxOperation.PublicFolderMailboxPrefix + DateTime.UtcNow.ToString("HHmmddss");
            PSCommand cmd   = new PSCommand();

            cmd.AddCommand("New-Mailbox");
            cmd.AddParameter("PublicFolder");
            cmd.AddParameter("IsExcludedFromServingHierarchy");
            cmd.AddParameter("Name", value);
            cmd.AddParameter("Organization", base.CurrentPublicFolderSession.OrganizationId.OrganizationalUnit.Name);
            Mailbox publicFolderMailbox = null;

            PublicFolderSplitHelper.PowerShellExceptionHandler(delegate(out string originOfException, out ErrorRecord error)
            {
                originOfException = "IdentifyTargetMailboxOperation::IsSplitNeeded::CreatePublicFolderMailbox - RunPSCommand - New-Mailbox -PublicFolder";
                IAssistantRunspaceProxy assistantRunspaceProxy = this.powershellFactory.CreateRunspaceForDatacenterAdmin(this.CurrentPublicFolderSession.OrganizationId);
                publicFolderMailbox = assistantRunspaceProxy.RunPSCommand <Mailbox>(cmd, out error, this.logger);
            }, this.splitOperationState);
            return(publicFolderMailbox);
        }
        // Token: 0x06000F5F RID: 3935 RVA: 0x0005B8C8 File Offset: 0x00059AC8
        private void SyncAndReturn(Guid mailboxGuid)
        {
            this.splitOperationState.PartialStep = true;
            ExchangePrincipal contentMailboxPrincipal;

            if (!PublicFolderSession.TryGetPublicFolderMailboxPrincipal(base.CurrentPublicFolderSession.OrganizationId, mailboxGuid, false, out contentMailboxPrincipal))
            {
                throw new ObjectNotFoundException(ServerStrings.PublicFolderMailboxNotFound);
            }
            PublicFolderSyncJobState publicFolderSyncJobState = PublicFolderSyncJobRpc.StartSyncHierarchy(contentMailboxPrincipal, false);

            if (PublicFolderSplitHelper.HasSyncFailure(publicFolderSyncJobState))
            {
                this.splitOperationState.Error = publicFolderSyncJobState.LastError;
                return;
            }
            if ((int)this.splitOperationState.PartialStepCount > PrepareTargetMailboxOperation.PartialStepIterationLimit)
            {
                this.splitOperationState.Error = new PartialStepsOverLimitException("Long running sync operation", PrepareTargetMailboxOperation.PartialStepIterationLimit);
            }
        }
示例#13
0
        // Token: 0x06000F17 RID: 3863 RVA: 0x0005A154 File Offset: 0x00058354
        public static Unlimited <ByteQuantifiedSize> GetMailboxQuota(IPublicFolderMailboxLoggerBase logger, IAssistantRunspaceFactory powershellFactory, Guid mailboxGuid, OrganizationId organizationId, ISplitOperationState splitOperationState)
        {
            ADObjectId mailboxDatabase                  = null;
            bool       useDatabaseQuotaDefaults         = false;
            Unlimited <ByteQuantifiedSize> mailboxQuota = Unlimited <ByteQuantifiedSize> .UnlimitedValue;
            string    value     = string.Format("{0}\\{1}", organizationId.OrganizationalUnit.Name, mailboxGuid.ToString());
            PSCommand psCommand = new PSCommand();

            psCommand.AddCommand("Get-Mailbox");
            psCommand.AddParameter("PublicFolder");
            psCommand.AddParameter("Identity", value);
            Mailbox publicFolderMailbox = null;

            PublicFolderSplitHelper.PowerShellExceptionHandler(delegate(out string originOfException, out ErrorRecord error)
            {
                error             = null;
                originOfException = "GetMailboxQuota - RunPSCommand: Get-Mailbox -PublicFolder";
                IAssistantRunspaceProxy assistantRunspaceProxy = powershellFactory.CreateRunspaceForDatacenterAdmin(organizationId);
                publicFolderMailbox = assistantRunspaceProxy.RunPSCommand <Mailbox>(psCommand, out error, logger);
                if (error == null)
                {
                    mailboxQuota                    = publicFolderMailbox.ProhibitSendQuota;
                    useDatabaseQuotaDefaults        = (publicFolderMailbox.UseDatabaseQuotaDefaults ?? false);
                    MailboxDatabase mailboxDatabase = publicFolderMailbox.Database;
                    if (useDatabaseQuotaDefaults && mailboxDatabase != null)
                    {
                        psCommand.Clear();
                        psCommand.AddCommand("Get-MailboxDatabase");
                        psCommand.AddParameter("Identity", mailboxDatabase.Name);
                        originOfException = "GetMailboxQuota - RunPSCommand: Get-MailboxDatabase";
                        mailboxDatabase   = assistantRunspaceProxy.RunPSCommand <MailboxDatabase>(psCommand, out error, logger);
                        if (error == null)
                        {
                            mailboxQuota = mailboxDatabase.ProhibitSendQuota;
                        }
                    }
                }
            }, splitOperationState);
            return(mailboxQuota);
        }
示例#14
0
        // Token: 0x06000F16 RID: 3862 RVA: 0x00059F68 File Offset: 0x00058168
        public static Unlimited <ByteQuantifiedSize> GetActualItemSize(IPublicFolderMailboxLoggerBase logger, IAssistantRunspaceFactory powershellFactory, Guid mailboxGuid, OrganizationId organizationId, ISplitOperationState splitOperationState)
        {
            Unlimited <ByteQuantifiedSize> actualItemSize  = ByteQuantifiedSize.Zero;
            Collection <PSObject>          output          = null;
            Collection <ErrorRecord>       errors          = null;
            Dictionary <string, string>    paramDictionary = new Dictionary <string, string>
            {
                {
                    "Mailbox",
                    mailboxGuid.ToString()
                },
                {
                    "Organization",
                    organizationId.OrganizationalUnit.Name
                }
            };
            string text = Path.Combine(ExchangeSetupContext.InstallPath, "Scripts");

            if (string.IsNullOrEmpty(text))
            {
                throw new SplitProcessorException("PublicFolderSplitHelper::GetActualItemSize - GetExchangeScriptsPath", new Exception("ExchangeScriptsPath is null or empty"));
            }
            string scriptFullPath = Path.Combine(text, "Get-PublicFolderMailboxSize.ps1");

            PublicFolderSplitHelper.PowerShellExceptionHandler(delegate(out string originOfException, out ErrorRecord error)
            {
                error             = null;
                originOfException = "GetActualItemSize - RunPowershellScript Get-PublicFolderMailboxSize.ps1";
                IAssistantRunspaceProxy assistantRunspaceProxy = powershellFactory.CreateRunspaceForDatacenterAdmin(organizationId);
                output = assistantRunspaceProxy.RunPowershellScript(scriptFullPath, paramDictionary, out errors, logger);
                if (errors == null && output != null && output.Count > 0)
                {
                    actualItemSize = (ByteQuantifiedSize)output[0].BaseObject;
                    return;
                }
                error = errors[0];
            }, splitOperationState);
            return(actualItemSize);
        }
        // Token: 0x06000ECC RID: 3788 RVA: 0x0005803C File Offset: 0x0005623C
        private PublicFolderMoveRequest IssueMoveRequest()
        {
            List <SplitPlanFolder> foldersToSplit = this.splitState.SplitPlan.FoldersToSplit;
            List <string>          list           = new List <string>();

            foreach (SplitPlanFolder splitPlanFolder in foldersToSplit)
            {
                list.Add(splitPlanFolder.PublicFolderId.MapiFolderPath.ToString());
            }
            string    publicFolderMoveRequestName = MoveContentOperation.PublicFolderMoveRequestPrefix + DateTime.UtcNow.ToString("HHmmddss");
            PSCommand cmd = new PSCommand();

            cmd.AddCommand("New-PublicFolderMoveRequest");
            cmd.AddParameter("AllowLargeItems");
            cmd.AddParameter("Name", publicFolderMoveRequestName);
            cmd.AddParameter("Folders", list.ToArray());
            cmd.AddParameter("TargetMailbox", this.splitState.TargetMailboxGuid.ToString());
            cmd.AddParameter("CompletedRequestAgeLimit", PublicFolderSplitConfig.Instance.CompletedPublicFolderMoveRequestAgeLimit);
            cmd.AddParameter("Organization", base.CurrentPublicFolderSession.OrganizationId.OrganizationalUnit.Name);
            PublicFolderMoveRequest moveRequest = null;

            PublicFolderSplitHelper.PowerShellExceptionHandler(delegate(out string originOfException, out ErrorRecord error)
            {
                originOfException = "MoveContentOperation::IssueMoveRequest - RunPSCommand - New-PublicFolderMoveRequest";
                IAssistantRunspaceProxy assistantRunspaceProxy = this.powershellFactory.CreateRunspaceForDatacenterAdmin(this.CurrentPublicFolderSession.OrganizationId);
                moveRequest = assistantRunspaceProxy.RunPSCommand <PublicFolderMoveRequest>(cmd, out error, this.logger);
                if (moveRequest != null)
                {
                    this.splitState.PublicFolderMoveRequestName = publicFolderMoveRequestName;
                }
            }, this.splitOperationState);
            if (this.splitOperationState.Error == null && moveRequest == null)
            {
                this.splitOperationState.Error = new IssuePublicFolderMoveRequestFailedException();
            }
            return(moveRequest);
        }
示例#16
0
        // Token: 0x06000F15 RID: 3861 RVA: 0x00059E04 File Offset: 0x00058004
        public static Unlimited <ByteQuantifiedSize> GetTotalItemSize(IPublicFolderMailboxLoggerBase logger, IAssistantRunspaceFactory powershellFactory, Guid mailboxGuid, OrganizationId organizationId, ISplitOperationState splitOperationState)
        {
            Unlimited <ByteQuantifiedSize> totalItemSize = ByteQuantifiedSize.Zero;
            string    value = string.Format("{0}\\{1}", organizationId.OrganizationalUnit.Name, mailboxGuid.ToString());
            PSCommand cmd   = new PSCommand();

            cmd.AddCommand("Get-MailboxStatistics");
            cmd.AddParameter("NoADLookup");
            cmd.AddParameter("Identity", value);
            MailboxStatistics publicFolderMailboxStatistics = null;

            PublicFolderSplitHelper.PowerShellExceptionHandler(delegate(out string originOfException, out ErrorRecord error)
            {
                error             = null;
                originOfException = "GetTotalItemSize - RunPSCommand Get-MailboxStatistics";
                IAssistantRunspaceProxy assistantRunspaceProxy = powershellFactory.CreateRunspaceForDatacenterAdmin(organizationId);
                publicFolderMailboxStatistics = assistantRunspaceProxy.RunPSCommand <MailboxStatistics>(cmd, out error, logger);
                if (error == null && publicFolderMailboxStatistics != null)
                {
                    totalItemSize = publicFolderMailboxStatistics.TotalItemSize;
                }
            }, splitOperationState);
            return(totalItemSize);
        }