protected override void InternalProcessRecord()
        {
            ADUser aduser = this.DataObject as ADUser;

            if (aduser == null || aduser.RecipientTypeDetails != RecipientTypeDetails.PublicFolderMailbox)
            {
                base.WriteError(new ObjectNotFoundException(Strings.PublicFolderMailboxNotFound), ExchangeErrorCategory.Client, null);
            }
            TenantPublicFolderConfiguration value = TenantPublicFolderConfigurationCache.Instance.GetValue(base.CurrentOrganizationId);

            if (value.GetLocalMailboxRecipient(aduser.ExchangeGuid) == null)
            {
                TenantPublicFolderConfigurationCache.Instance.RemoveValue(base.CurrentOrganizationId);
            }
            DiagnosticsLoadFlags diagnosticsLoadFlags = DiagnosticsLoadFlags.Default;

            if (this.IncludeDumpsterInfo)
            {
                diagnosticsLoadFlags |= DiagnosticsLoadFlags.DumpsterInfo;
            }
            if (this.IncludeHierarchyInfo)
            {
                diagnosticsLoadFlags |= DiagnosticsLoadFlags.HierarchyInfo;
            }
            PublicFolderMailboxDiagnosticsInfo sendToPipeline = PublicFolderMailboxDiagnosticsInfo.Load(base.CurrentOrganizationId, aduser.ExchangeGuid, diagnosticsLoadFlags, new Action <LocalizedString, LocalizedString, int>(base.WriteProgress));

            base.WriteObject(sendToPipeline);
        }
        internal static PublicFolderMailboxDiagnosticsInfo Load(PublicFolderSession session, DiagnosticsLoadFlags loadFlags, Action <LocalizedString, LocalizedString, int> writeProgress)
        {
            PublicFolderMailboxDiagnosticsInfo publicFolderMailboxDiagnosticsInfo = new PublicFolderMailboxDiagnosticsInfo("Public Folder Diagnostics Information");

            publicFolderMailboxDiagnosticsInfo.SyncInfo      = (PublicFolderMailboxDiagnosticsInfo.LoadMailboxInfo <PublicFolderMailboxSynchronizerInfo>(session, "PublicFolderSyncInfo", "PublicFolderLastSyncCylceLog") as PublicFolderMailboxSynchronizerInfo);
            publicFolderMailboxDiagnosticsInfo.AssistantInfo = (PublicFolderMailboxDiagnosticsInfo.LoadMailboxInfo <PublicFolderMailboxAssistantInfo>(session, "PublicFolderAssistantInfo", "PublicFolderLastAssistantCycleLog") as PublicFolderMailboxAssistantInfo);
            if ((loadFlags & DiagnosticsLoadFlags.DumpsterInfo) != DiagnosticsLoadFlags.Default)
            {
                publicFolderMailboxDiagnosticsInfo.DumpsterInfo = PublicFolderMailboxDumpsterInfo.LoadInfo(session, writeProgress);
            }
            if ((loadFlags & DiagnosticsLoadFlags.HierarchyInfo) != DiagnosticsLoadFlags.Default)
            {
                publicFolderMailboxDiagnosticsInfo.HierarchyInfo = PublicFolderMailboxHierarchyInfo.LoadInfo(session, writeProgress);
            }
            return(publicFolderMailboxDiagnosticsInfo);
        }
        internal static PublicFolderMailboxDiagnosticsInfo Load(OrganizationId organizationId, Guid contentMailboxGuid, DiagnosticsLoadFlags loadFlags, Action <LocalizedString, LocalizedString, int> writeProgress)
        {
            PublicFolderMailboxDiagnosticsInfo result;

            using (PublicFolderSession publicFolderSession = PublicFolderSession.OpenAsAdmin(organizationId, null, contentMailboxGuid, null, CultureInfo.CurrentCulture, "Client=Management;Action=Get-PublicFolderMailboxDiagnostics", null))
            {
                result = PublicFolderMailboxDiagnosticsInfo.Load(publicFolderSession, loadFlags, writeProgress);
            }
            return(result);
        }