public EhfADResultCode TrySetDuplicateDomain(EhfADAdapter ehfADAdapter, bool isDuplicate) { int flagsValue = base.GetFlagsValue("msExchTransportInboundSettings"); int num; if (isDuplicate) { num = (flagsValue | 1); } else { num = (flagsValue & -2); } if (flagsValue == num) { base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Medium, "DuplicateDetected field is set to the expected value {0} for domain <{1}>:<{2}>. Not setting the value.", new object[] { flagsValue, base.DistinguishedName, base.GetDomainGuid() }); return(EhfADResultCode.Success); } EhfADResultCode result; try { base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Low, "Setting DuplicateDetected field from {0} to {1} for domain <{2}>:<{3}>.", new object[] { flagsValue, num, base.DistinguishedName, base.GetDomainGuid() }); ehfADAdapter.SetAttributeValue(base.GetDomainGuid(), "msExchTransportInboundSettings", num.ToString()); result = EhfADResultCode.Success; } catch (ExDirectoryException ex) { if (ex.ResultCode == ResultCode.NoSuchObject) { base.DiagSession.LogAndTraceException(ex, "NoSuchObject error occurred while trying to set the DuplicateDetected flag for domain <{0}>:<{1}>", new object[] { base.DistinguishedName, base.GetDomainGuid() }); result = EhfADResultCode.NoSuchObject; } else { base.DiagSession.LogAndTraceException(ex, "Exception occurred while trying to set the DuplicateDetected flag for domain <{0}>:<{1}>", new object[] { base.DistinguishedName, base.GetDomainGuid() }); result = EhfADResultCode.Failure; } } return(result); }
public static void ClearForceDomainSyncFlagFromPerimeterConfig(EhfADAdapter adAdapter, Guid companyGuid) { adAdapter.SetAttributeValue(companyGuid, "msExchTransportInboundSettings", 0.ToString()); }