コード例 #1
0
        private static bool LoadAcceptedDomain(ExSearchResultEntry entry, Connection sourceConnection, TargetConnection targetConnection, object state)
        {
            EhfConfigTargetConnection ehfConfigTargetConnection = (EhfConfigTargetConnection)targetConnection;

            if (!EhfSynchronizer.LoadFullEntry(entry, EhfDomainSynchronizer.AcceptedDomainAllAttributes, ehfConfigTargetConnection))
            {
                return(false);
            }
            if (!EhfDomainSynchronizer.ValidateDomainName(entry, ehfConfigTargetConnection.DiagSession))
            {
                return(false);
            }
            string configUnitDN = null;

            if (!EhfDomainSynchronizer.TryGetConfigUnit(entry, ehfConfigTargetConnection.DiagSession, out configUnitDN))
            {
                return(false);
            }
            EhfCompanyIdentity ehfCompanyIdentity;

            if (!ehfConfigTargetConnection.TryGetEhfCompanyIdentity(configUnitDN, "ignoring the object", out ehfCompanyIdentity))
            {
                return(false);
            }
            EhfDomainSynchronizer.AddAttributeToChangeEntry(entry, "msExchTenantPerimeterSettingsOrgID", ehfCompanyIdentity.EhfCompanyId.ToString());
            EhfDomainSynchronizer.AddAttributeToChangeEntry(entry, "msEdgeSyncEhfCompanyGuid", ehfCompanyIdentity.EhfCompanyGuid.ToString());
            return(true);
        }
コード例 #2
0
        public void CreateEhfDomainsForNewCompany(string transportSettingsDN, int ehfCompanyId, Guid ehfCompanyGuid)
        {
            if (ehfCompanyGuid == Guid.Empty)
            {
                throw new ArgumentException("Ehf company Guid is empty for company " + transportSettingsDN, "ehfCompanyGuid");
            }
            IEnumerable <ExSearchResultEntry> enumerable = base.ADAdapter.PagedScan(transportSettingsDN, Schema.Query.QueryAcceptedDomains, EhfDomainSynchronizer.AcceptedDomainAllAttributes);

            foreach (ExSearchResultEntry entry in enumerable)
            {
                EhfDomainSynchronizer.AddAttributeToChangeEntry(entry, "msEdgeSyncEhfCompanyGuid", ehfCompanyGuid.ToString());
                this.CreateEhfDomainForNewCompany(entry, ehfCompanyId);
            }
            if (!this.SetForcedDomainSyncOnLastDomain(ehfCompanyGuid))
            {
                try
                {
                    EhfDomainItem.ClearForceDomainSyncFlagFromPerimeterConfig(base.ADAdapter, ehfCompanyGuid);
                }
                catch (ExDirectoryException ex)
                {
                    if (ex.ResultCode == ResultCode.NoSuchObject)
                    {
                        base.DiagSession.LogAndTraceException(ex, "NoSuchObject error occurred while trying to clear the ForceDomainSync flag in Perimeter Settings for Company <{0}>:<{1}>", new object[]
                        {
                            transportSettingsDN,
                            ehfCompanyGuid
                        });
                    }
                    else
                    {
                        base.DiagSession.LogAndTraceException(ex, "Exception occurred while trying to clear the ForceDomainSync flag in Perimeter Settings for company <{0}>:<{1}>", new object[]
                        {
                            transportSettingsDN,
                            ehfCompanyGuid
                        });
                        base.DiagSession.EventLog.LogEvent(EdgeSyncEventLogConstants.Tuple_EhfFailedToClearForceDomainSyncFlagFromCompanySync, null, new object[]
                        {
                            transportSettingsDN,
                            ex.Message
                        });
                    }
                }
            }
        }