示例#1
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     try
     {
         ArchiveConnectivityOutcome sendToPipeline = new ArchiveConnectivityOutcome(this.UserSmtp.ToString(), this.primaryFAI, this.primaryLastProcessedTime, this.archiveDomain, this.archiveDatabase, this.archiveFAI, this.archiveLastProcessedTime, this.complianceConfiguration, this.mrmProperties);
         this.PerformArchiveConnectivityTest(ref sendToPipeline);
         base.WriteObject(sendToPipeline);
     }
     finally
     {
         TaskLogger.LogExit();
     }
 }
示例#2
0
        private void PerformArchiveConnectivityTest(ref ArchiveConnectivityOutcome result)
        {
            bool flag  = false;
            bool flag2 = false;

            try
            {
                SmtpAddress       userSmtp          = this.UserSmtp;
                ExchangePrincipal exchangePrincipal = ExchangePrincipal.FromProxyAddress(ADSessionSettings.RootOrgOrSingleTenantFromAcceptedDomainAutoDetect(userSmtp.Domain), userSmtp.ToString());
                if (exchangePrincipal != null)
                {
                    if (this.IncludeArchiveMRMConfiguration || !string.IsNullOrEmpty(this.MessageId))
                    {
                        this.LogonPrimary(exchangePrincipal);
                        result.PrimaryMRMConfiguration  = this.primaryFAI;
                        result.PrimaryLastProcessedTime = this.primaryLastProcessedTime;
                    }
                    flag = true;
                    ADObjectId        objectId = exchangePrincipal.ObjectId;
                    IRecipientSession tenantOrRootOrgRecipientSession;
                    if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.MultiTenancy.Enabled)
                    {
                        tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(false, ConsistencyMode.FullyConsistent, exchangePrincipal.MailboxInfo.OrganizationId.ToADSessionSettings(), 276, "PerformArchiveConnectivityTest", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Monitoring\\ArchiveConnectivity\\TestArchiveConnectivityTask.cs");
                    }
                    else
                    {
                        tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(false, ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 284, "PerformArchiveConnectivityTest", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Monitoring\\ArchiveConnectivity\\TestArchiveConnectivityTask.cs");
                    }
                    ADUser aduser = tenantOrRootOrgRecipientSession.FindADUserByObjectId(objectId);
                    this.complianceConfiguration   = aduser.ElcMailboxFlags.ToString();
                    result.ComplianceConfiguration = this.complianceConfiguration;
                    if (exchangePrincipal.GetArchiveMailbox() == null)
                    {
                        result.Update(ArchiveConnectivityResultEnum.ArchiveFailure, Strings.ArchiveConnectivityResultArchiveNotProvisioned);
                    }
                    else
                    {
                        if (aduser.ArchiveDomain != null)
                        {
                            result.ArchiveDomain = aduser.ArchiveDomain.ToString();
                            flag2 = true;
                        }
                        if (aduser.ArchiveDatabase != null)
                        {
                            result.ArchiveDatabase = aduser.ArchiveDatabase.ToString();
                        }
                        if (aduser.RecipientType == RecipientType.UserMailbox)
                        {
                            if (flag2)
                            {
                                if (ArchiveStatusFlags.Active != aduser.ArchiveStatus)
                                {
                                    result.Update(ArchiveConnectivityResultEnum.ArchiveFailure, Strings.ArchiveConnectivityResultArchiveNotActive);
                                }
                                else if (this.LogonArchive(this.GetArchivePrincipal(exchangePrincipal, aduser)))
                                {
                                    result.Update(ArchiveConnectivityResultEnum.Success, "");
                                }
                            }
                            else if (this.LogonArchive(this.GetArchivePrincipal(exchangePrincipal, aduser)))
                            {
                                result.Update(ArchiveConnectivityResultEnum.Success, "");
                            }
                        }
                        if (this.IncludeArchiveMRMConfiguration)
                        {
                            result.ArchiveMRMConfiguration  = this.archiveFAI;
                            result.ArchiveLastProcessedTime = this.archiveLastProcessedTime;
                        }
                    }
                }
                this.mrmProperties = this.mrmPropReport.ToString();
                if (!string.IsNullOrEmpty(this.mrmProperties))
                {
                    result.ItemMRMProperties = this.mrmProperties;
                }
                else if (!string.IsNullOrEmpty(this.MessageId))
                {
                    result.ItemMRMProperties = "Item not found.";
                }
            }
            catch (ObjectNotFoundException ex)
            {
                if (!flag)
                {
                    result.Update(ArchiveConnectivityResultEnum.PrimaryFailure, this.GetAllInnerExceptions(ex));
                }
                else
                {
                    result.Update(ArchiveConnectivityResultEnum.ArchiveFailure, this.GetAllInnerExceptions(ex));
                }
            }
            catch (ConnectionFailedTransientException ex2)
            {
                result.Update(ArchiveConnectivityResultEnum.ArchiveFailure, this.GetAllInnerExceptions(ex2));
            }
            catch (AutoDAccessException ex3)
            {
                result.Update(ArchiveConnectivityResultEnum.ArchiveFailure, this.GetAllInnerExceptions(ex3));
            }
            catch (StoragePermanentException ex4)
            {
                result.Update(ArchiveConnectivityResultEnum.ArchiveFailure, this.GetAllInnerExceptions(ex4));
            }
            catch (StorageTransientException ex5)
            {
                result.Update(ArchiveConnectivityResultEnum.ArchiveFailure, this.GetAllInnerExceptions(ex5));
            }
            catch (ArgumentException ex6)
            {
                result.Update(ArchiveConnectivityResultEnum.ArchiveFailure, this.GetAllInnerExceptions(ex6));
            }
        }