private static PolicyData GetDefaultPolicySetting(IAirSyncUser user) { ADObjectId configurationUnit = user.ADUser.ConfigurationUnit; if (configurationUnit == null) { if (ADNotificationManager.enterpriseConfigurationID == null) { IConfigurationSession configurationSession = ADNotificationManager.CreateScopedADSession(user); ADNotificationManager.enterpriseConfigurationID = configurationSession.GetOrgContainerId(); user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.DomainController, configurationSession.LastUsedDc); } configurationUnit = ADNotificationManager.enterpriseConfigurationID; } Func <PolicyData> loadDataAction = () => ADNotificationManager.LoadDefaultPolicySetting(ADNotificationManager.CreateScopedADSession(user), user.Context.ProtocolLogger); ADNotificationManager.ADSettingsInfo <PolicyData> adsettingsInfo; bool flag = ADNotificationManager.LoadADSettingsData <PolicyData>(ADNotificationManager.policies, configurationUnit.DistinguishedName, loadDataAction, user.OrganizationId.PartitionId, out adsettingsInfo); if (flag && adsettingsInfo.ADSettingsData == null) { AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, null, "Default PolicySettings not found. Save null in cache.Policy DN {0}", configurationUnit.DistinguishedName); ADNotificationManager.policies.Add(configurationUnit.DistinguishedName, new ADNotificationManager.ADSettingsInfo <PolicyData>(user.OrganizationId.PartitionId, null, ExDateTime.UtcNow)); } AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, null, "Returning Default PolicySettings data. DN {0}", configurationUnit.DistinguishedName); return(adsettingsInfo.ADSettingsData); }