internal ReplicationConnectionCollection GetOutboundConnectionsHelper() { string siteObjectName; string serverObjectName; if (this.outbound == null) { if (this as DomainController != null) { siteObjectName = ((DomainController)this).SiteObjectName; } else { siteObjectName = ((AdamInstance)this).SiteObjectName; } string str = siteObjectName; DirectoryEntry directoryEntry = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context), str); if (this as DomainController != null) { serverObjectName = ((DomainController)this).ServerObjectName; } else { serverObjectName = ((AdamInstance)this).ServerObjectName; } string str1 = serverObjectName; string[] strArrays = new string[2]; strArrays[0] = "objectClass"; strArrays[1] = "cn"; ADSearcher aDSearcher = new ADSearcher(directoryEntry, string.Concat("(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection)(fromServer=CN=NTDS Settings,", str1, "))"), strArrays, SearchScope.Subtree); SearchResultCollection searchResultCollections = null; DirectoryContext newDirectoryContext = Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context); try { try { searchResultCollections = aDSearcher.FindAll(); this.outbound = new ReplicationConnectionCollection(); foreach (SearchResult searchResult in searchResultCollections) { ReplicationConnection replicationConnection = new ReplicationConnection(newDirectoryContext, searchResult.GetDirectoryEntry(), (string)searchResult.Properties["cn"][0]); this.outbound.Add(replicationConnection); } } catch (COMException cOMException1) { COMException cOMException = cOMException1; throw ExceptionHelper.GetExceptionFromCOMException(newDirectoryContext, cOMException); } } finally { if (searchResultCollections != null) { searchResultCollections.Dispose(); } directoryEntry.Dispose(); } } return this.outbound; }
public bool Contains(ReplicationConnection connection) { if (connection == null) { throw new ArgumentNullException(nameof(connection)); } if (!connection.existingConnection) { throw new InvalidOperationException(SR.Format(SR.ConnectionNotCommitted, connection.Name)); } string dn = (string)PropertyManager.GetPropertyValue(connection.context, connection.cachedDirectoryEntry, PropertyManager.DistinguishedName); for (int i = 0; i < InnerList.Count; i++) { ReplicationConnection tmp = (ReplicationConnection)InnerList[i]; string tmpDn = (string)PropertyManager.GetPropertyValue(tmp.context, tmp.cachedDirectoryEntry, PropertyManager.DistinguishedName); if (Utils.Compare(tmpDn, dn) == 0) { return(true); } } return(false); }
public int IndexOf(ReplicationConnection connection) { if (connection == null) { throw new ArgumentNullException("connection"); } if (!connection.existingConnection) { throw new InvalidOperationException(Res.GetString(Res.ConnectionNotCommitted, connection.Name)); } string dn = (string)PropertyManager.GetPropertyValue(connection.context, connection.cachedDirectoryEntry, PropertyManager.DistinguishedName); for (int i = 0; i < InnerList.Count; i++) { ReplicationConnection tmp = (ReplicationConnection)InnerList[i]; string tmpDn = (string)PropertyManager.GetPropertyValue(tmp.context, tmp.cachedDirectoryEntry, PropertyManager.DistinguishedName); if (Utils.Compare(tmpDn, dn) == 0) { return(i); } } return(-1); }
public int IndexOf(ReplicationConnection connection) { if (connection != null) { if (connection.existingConnection) { string propertyValue = (string)PropertyManager.GetPropertyValue(connection.context, connection.cachedDirectoryEntry, PropertyManager.DistinguishedName); int num = 0; while (num < base.InnerList.Count) { ReplicationConnection item = (ReplicationConnection)base.InnerList[num]; string str = (string)PropertyManager.GetPropertyValue(item.context, item.cachedDirectoryEntry, PropertyManager.DistinguishedName); if (Utils.Compare(str, propertyValue) != 0) { num++; } else { return num; } } return -1; } else { object[] name = new object[1]; name[0] = connection.Name; throw new InvalidOperationException(Res.GetString("ConnectionNotCommitted", name)); } } else { throw new ArgumentNullException("connection"); } }
public int IndexOf(ReplicationConnection connection) { Contract.Requires(connection != null); Contract.Ensures(Contract.Result <int>() >= -1); Contract.Ensures(Contract.Result <int>() < this.Count); return(default(int)); }
public int IndexOf(ReplicationConnection connection) { Contract.Requires(connection != null); Contract.Ensures(Contract.Result<int>() >= -1); Contract.Ensures(Contract.Result<int>() < this.Count); return default(int); }
internal ReplicationConnectionCollection GetInboundConnectionsHelper() { string serverObjectName; if (this.inbound == null) { this.inbound = new ReplicationConnectionCollection(); DirectoryContext newDirectoryContext = Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context); if (this as DomainController != null) { serverObjectName = ((DomainController)this).ServerObjectName; } else { serverObjectName = ((AdamInstance)this).ServerObjectName; } string str = serverObjectName; string str1 = string.Concat("CN=NTDS Settings,", str); DirectoryEntry directoryEntry = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context), str1); string[] strArrays = new string[1]; strArrays[0] = "cn"; ADSearcher aDSearcher = new ADSearcher(directoryEntry, "(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection))", strArrays, SearchScope.OneLevel); SearchResultCollection searchResultCollections = null; try { try { searchResultCollections = aDSearcher.FindAll(); foreach (SearchResult searchResult in searchResultCollections) { ReplicationConnection replicationConnection = new ReplicationConnection(newDirectoryContext, searchResult.GetDirectoryEntry(), (string)PropertyManager.GetSearchResultPropertyValue(searchResult, PropertyManager.Cn)); this.inbound.Add(replicationConnection); } } catch (COMException cOMException1) { COMException cOMException = cOMException1; throw ExceptionHelper.GetExceptionFromCOMException(newDirectoryContext, cOMException); } } finally { if (searchResultCollections != null) { searchResultCollections.Dispose(); } directoryEntry.Dispose(); } } return(this.inbound); }
public static ReplicationConnection FindByName(DirectoryContext context, string name) { ReplicationConnection replicationConnection; ReplicationConnection.ValidateArgument(context, name); context = new DirectoryContext(context); DirectoryEntry directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE); try { string propertyValue = (string)PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ServerName); string str = string.Concat("CN=NTDS Settings,", propertyValue); directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, str); string[] strArrays = new string[1]; strArrays[0] = "distinguishedName"; ADSearcher aDSearcher = new ADSearcher(directoryEntry, string.Concat("(&(objectClass=nTDSConnection)(objectCategory=NTDSConnection)(name=", Utils.GetEscapedFilterValue(name), "))"), strArrays, SearchScope.OneLevel, false, false); SearchResult searchResult = null; try { searchResult = aDSearcher.FindOne(); } catch (COMException cOMException1) { COMException cOMException = cOMException1; if (cOMException.ErrorCode != -2147016656) { throw ExceptionHelper.GetExceptionFromCOMException(context, cOMException); } else { throw new ActiveDirectoryObjectNotFoundException(Res.GetString("DSNotFound"), typeof(ReplicationConnection), name); } } if (searchResult != null) { DirectoryEntry directoryEntry1 = searchResult.GetDirectoryEntry(); replicationConnection = new ReplicationConnection(context, directoryEntry1, name); } else { Exception activeDirectoryObjectNotFoundException = new ActiveDirectoryObjectNotFoundException(Res.GetString("DSNotFound"), typeof(ReplicationConnection), name); throw activeDirectoryObjectNotFoundException; } } finally { directoryEntry.Dispose(); } return(replicationConnection); }
internal ReplicationConnectionCollection GetOutboundConnectionsHelper() { // this is the first time that user tries to retrieve this property, so get it from the directory if (_outbound == null) { // search base is the site container string siteName = (this is DomainController) ? ((DomainController)this).SiteObjectName : ((AdamInstance)this).SiteObjectName; DirectoryEntry de = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(Name, DirectoryContextType.DirectoryServer, context), siteName); string serverName = (this is DomainController) ? ((DomainController)this).ServerObjectName : ((AdamInstance)this).ServerObjectName; ADSearcher adSearcher = new ADSearcher(de, "(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection)(fromServer=CN=NTDS Settings," + serverName + "))", new string[] { "objectClass", "cn" }, SearchScope.Subtree); SearchResultCollection results = null; DirectoryContext newContext = Utils.GetNewDirectoryContext(Name, DirectoryContextType.DirectoryServer, context); try { results = adSearcher.FindAll(); _outbound = new ReplicationConnectionCollection(); foreach (SearchResult result in results) { ReplicationConnection con = new ReplicationConnection(newContext, result.GetDirectoryEntry(), (string)result.Properties["cn"][0]); _outbound.Add(con); } } catch (COMException e) { throw ExceptionHelper.GetExceptionFromCOMException(newContext, e); } finally { if (results != null) { results.Dispose(); } de.Dispose(); } } return(_outbound); }
internal ReplicationConnectionCollection GetInboundConnectionsHelper() { if (_inbound == null) { // construct the replicationconnection collection _inbound = new ReplicationConnectionCollection(); DirectoryContext newContext = Utils.GetNewDirectoryContext(Name, DirectoryContextType.DirectoryServer, context); // this is the first time that user tries to retrieve this property, so get it from the directory string serverName = (this is DomainController) ? ((DomainController)this).ServerObjectName : ((AdamInstance)this).ServerObjectName; string srchDN = "CN=NTDS Settings," + serverName; DirectoryEntry de = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(Name, DirectoryContextType.DirectoryServer, context), srchDN); ADSearcher adSearcher = new ADSearcher(de, "(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection))", new string[] { "cn" }, SearchScope.OneLevel); SearchResultCollection srchResults = null; try { srchResults = adSearcher.FindAll(); foreach (SearchResult r in srchResults) { ReplicationConnection con = new ReplicationConnection(newContext, r.GetDirectoryEntry(), (string)PropertyManager.GetSearchResultPropertyValue(r, PropertyManager.Cn)); _inbound.Add(con); } } catch (COMException e) { throw ExceptionHelper.GetExceptionFromCOMException(newContext, e); } finally { if (srchResults != null) { srchResults.Dispose(); } de.Dispose(); } } return(_inbound); }
public int IndexOf(ReplicationConnection connection) { if (connection == null) throw new ArgumentNullException("connection"); if (!connection.existingConnection) throw new InvalidOperationException(Res.GetString(Res.ConnectionNotCommitted, connection.Name)); string dn = (string)PropertyManager.GetPropertyValue(connection.context, connection.cachedDirectoryEntry, PropertyManager.DistinguishedName); for (int i = 0; i < InnerList.Count; i++) { ReplicationConnection tmp = (ReplicationConnection)InnerList[i]; string tmpDn = (string)PropertyManager.GetPropertyValue(tmp.context, tmp.cachedDirectoryEntry, PropertyManager.DistinguishedName); if (Utils.Compare(tmpDn, dn) == 0) { return i; } } return -1; }
public int IndexOf(ReplicationConnection connection) { if (connection == null) { throw new ArgumentNullException("connection"); } if (!connection.existingConnection) { throw new InvalidOperationException(Res.GetString("ConnectionNotCommitted", new object[] { connection.Name })); } string str = (string) PropertyManager.GetPropertyValue(connection.context, connection.cachedDirectoryEntry, PropertyManager.DistinguishedName); for (int i = 0; i < base.InnerList.Count; i++) { ReplicationConnection connection2 = (ReplicationConnection) base.InnerList[i]; string str2 = (string) PropertyManager.GetPropertyValue(connection2.context, connection2.cachedDirectoryEntry, PropertyManager.DistinguishedName); if (Utils.Compare(str2, str) == 0) { return i; } } return -1; }
public int IndexOf(ReplicationConnection connection) { if (connection == null) { throw new ArgumentNullException("connection"); } if (!connection.existingConnection) { throw new InvalidOperationException(Res.GetString("ConnectionNotCommitted", new object[] { connection.Name })); } string str = (string)PropertyManager.GetPropertyValue(connection.context, connection.cachedDirectoryEntry, PropertyManager.DistinguishedName); for (int i = 0; i < base.InnerList.Count; i++) { ReplicationConnection connection2 = (ReplicationConnection)base.InnerList[i]; string str2 = (string)PropertyManager.GetPropertyValue(connection2.context, connection2.cachedDirectoryEntry, PropertyManager.DistinguishedName); if (Utils.Compare(str2, str) == 0) { return(i); } } return(-1); }
internal int Add(ReplicationConnection value) { return(base.InnerList.Add(value)); }
internal ReplicationConnectionCollection GetOutboundConnectionsHelper() { // this is the first time that user tries to retrieve this property, so get it from the directory if (_outbound == null) { // search base is the site container string siteName = (this is DomainController) ? ((DomainController)this).SiteObjectName : ((AdamInstance)this).SiteObjectName; DirectoryEntry de = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(Name, DirectoryContextType.DirectoryServer, context), siteName); string serverName = (this is DomainController) ? ((DomainController)this).ServerObjectName : ((AdamInstance)this).ServerObjectName; ADSearcher adSearcher = new ADSearcher(de, "(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection)(fromServer=CN=NTDS Settings," + serverName + "))", new string[] { "objectClass", "cn" }, SearchScope.Subtree); SearchResultCollection results = null; DirectoryContext newContext = Utils.GetNewDirectoryContext(Name, DirectoryContextType.DirectoryServer, context); try { results = adSearcher.FindAll(); _outbound = new ReplicationConnectionCollection(); foreach (SearchResult result in results) { ReplicationConnection con = new ReplicationConnection(newContext, result.GetDirectoryEntry(), (string)result.Properties["cn"][0]); _outbound.Add(con); } } catch (COMException e) { throw ExceptionHelper.GetExceptionFromCOMException(newContext, e); } finally { if (results != null) results.Dispose(); de.Dispose(); } } return _outbound; }
internal ReplicationConnectionCollection GetInboundConnectionsHelper() { if (_inbound == null) { // construct the replicationconnection collection _inbound = new ReplicationConnectionCollection(); DirectoryContext newContext = Utils.GetNewDirectoryContext(Name, DirectoryContextType.DirectoryServer, context); // this is the first time that user tries to retrieve this property, so get it from the directory string serverName = (this is DomainController) ? ((DomainController)this).ServerObjectName : ((AdamInstance)this).ServerObjectName; string srchDN = "CN=NTDS Settings," + serverName; DirectoryEntry de = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(Name, DirectoryContextType.DirectoryServer, context), srchDN); ADSearcher adSearcher = new ADSearcher(de, "(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection))", new string[] { "cn" }, SearchScope.OneLevel); SearchResultCollection srchResults = null; try { srchResults = adSearcher.FindAll(); foreach (SearchResult r in srchResults) { ReplicationConnection con = new ReplicationConnection(newContext, r.GetDirectoryEntry(), (string)PropertyManager.GetSearchResultPropertyValue(r, PropertyManager.Cn)); _inbound.Add(con); } } catch (COMException e) { throw ExceptionHelper.GetExceptionFromCOMException(newContext, e); } finally { if (srchResults != null) srchResults.Dispose(); de.Dispose(); } } return _inbound; }
public bool Contains(ReplicationConnection connection) { Contract.Requires(connection != null); return(default(bool)); }
public void CopyTo (ReplicationConnection[] connections, int index) { throw new NotImplementedException (); }
internal ReplicationConnectionCollection GetInboundConnectionsHelper() { if (this.inbound == null) { this.inbound = new ReplicationConnectionCollection(); DirectoryContext context = Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context); string str = (this is DomainController) ? ((DomainController) this).ServerObjectName : ((AdamInstance) this).ServerObjectName; string dn = "CN=NTDS Settings," + str; DirectoryEntry directoryEntry = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context), dn); ADSearcher searcher = new ADSearcher(directoryEntry, "(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection))", new string[] { "cn" }, SearchScope.OneLevel); SearchResultCollection results = null; try { results = searcher.FindAll(); foreach (SearchResult result in results) { ReplicationConnection connection = new ReplicationConnection(context, result.GetDirectoryEntry(), (string) PropertyManager.GetSearchResultPropertyValue(result, PropertyManager.Cn)); this.inbound.Add(connection); } } catch (COMException exception) { throw ExceptionHelper.GetExceptionFromCOMException(context, exception); } finally { if (results != null) { results.Dispose(); } directoryEntry.Dispose(); } } return this.inbound; }
internal int Add(ReplicationConnection value) => InnerList.Add(value);
public bool Contains (ReplicationConnection connection) { throw new NotImplementedException (); }
public static void CreateNewConnection(string sourceServer, string targetServer, string connectionName) { try { // set a directory server context for the source server DirectoryContext sourceContext = new DirectoryContext( DirectoryContextType.DirectoryServer, sourceServer); // set a directory server context for the target server DirectoryContext targetContext = new DirectoryContext( DirectoryContextType.DirectoryServer, targetServer); // bind to a specific domain controller to serve as the // source of a replication connection DomainController sourceDc = DomainController.GetDomainController(sourceContext); ReplicationConnection connection = new ReplicationConnection( targetContext, connectionName, sourceDc); // set change notification status connection.ChangeNotificationStatus = NotificationStatus.IntraSiteOnly; // create a customized replication schedule ActiveDirectorySchedule schedule = new ActiveDirectorySchedule(); schedule.SetDailySchedule(HourOfDay.Twelve, MinuteOfHour.Zero, HourOfDay.Fifteen, MinuteOfHour.Zero); schedule.SetSchedule(DayOfWeek.Sunday, HourOfDay.Eight, MinuteOfHour.Zero, HourOfDay.Eleven, MinuteOfHour.Zero); schedule.SetSchedule(DayOfWeek.Saturday, HourOfDay.Seven, MinuteOfHour.Zero, HourOfDay.Ten, MinuteOfHour.Zero); connection.ReplicationSchedule = schedule; connection.ReplicationScheduleOwnedByUser = true; // save the new connection to the directory connection.Save(); Console.WriteLine("\nNew replication connection created successfully\n" + "from server {0} to {1}.\n The connection appears in the NTDS " + "settings of {1}", sourceServer, targetServer); } catch (Exception e) { Console.WriteLine("\r\nUnexpected exception occured:\n{0}:{1}", e.GetType().Name, e.Message); } }
public void CopyTo(ReplicationConnection[] connections, int index) { InnerList.CopyTo(connections, index); }
public int IndexOf(ReplicationConnection connection) { throw new NotImplementedException(); }
public bool Contains(ReplicationConnection connection) { throw new NotImplementedException(); }
public static ReplicationConnection FindByName(DirectoryContext context, string name) { ReplicationConnection replicationConnection; ReplicationConnection.ValidateArgument(context, name); context = new DirectoryContext(context); DirectoryEntry directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE); try { string propertyValue = (string)PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ServerName); string str = string.Concat("CN=NTDS Settings,", propertyValue); directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, str); string[] strArrays = new string[1]; strArrays[0] = "distinguishedName"; ADSearcher aDSearcher = new ADSearcher(directoryEntry, string.Concat("(&(objectClass=nTDSConnection)(objectCategory=NTDSConnection)(name=", Utils.GetEscapedFilterValue(name), "))"), strArrays, SearchScope.OneLevel, false, false); SearchResult searchResult = null; try { searchResult = aDSearcher.FindOne(); } catch (COMException cOMException1) { COMException cOMException = cOMException1; if (cOMException.ErrorCode != -2147016656) { throw ExceptionHelper.GetExceptionFromCOMException(context, cOMException); } else { throw new ActiveDirectoryObjectNotFoundException(Res.GetString("DSNotFound"), typeof(ReplicationConnection), name); } } if (searchResult != null) { DirectoryEntry directoryEntry1 = searchResult.GetDirectoryEntry(); replicationConnection = new ReplicationConnection(context, directoryEntry1, name); } else { Exception activeDirectoryObjectNotFoundException = new ActiveDirectoryObjectNotFoundException(Res.GetString("DSNotFound"), typeof(ReplicationConnection), name); throw activeDirectoryObjectNotFoundException; } } finally { directoryEntry.Dispose(); } return replicationConnection; }
internal ReplicationConnectionCollection GetOutboundConnectionsHelper() { if (this.outbound == null) { string dn = (this is DomainController) ? ((DomainController) this).SiteObjectName : ((AdamInstance) this).SiteObjectName; DirectoryEntry directoryEntry = DirectoryEntryManager.GetDirectoryEntry(Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context), dn); string str2 = (this is DomainController) ? ((DomainController) this).ServerObjectName : ((AdamInstance) this).ServerObjectName; ADSearcher searcher = new ADSearcher(directoryEntry, "(&(objectClass=nTDSConnection)(objectCategory=nTDSConnection)(fromServer=CN=NTDS Settings," + str2 + "))", new string[] { "objectClass", "cn" }, SearchScope.Subtree); SearchResultCollection results = null; DirectoryContext context = Utils.GetNewDirectoryContext(this.Name, DirectoryContextType.DirectoryServer, this.context); try { results = searcher.FindAll(); this.outbound = new ReplicationConnectionCollection(); foreach (SearchResult result in results) { ReplicationConnection connection = new ReplicationConnection(context, result.GetDirectoryEntry(), (string) result.Properties["cn"][0]); this.outbound.Add(connection); } } catch (COMException exception) { throw ExceptionHelper.GetExceptionFromCOMException(context, exception); } finally { if (results != null) { results.Dispose(); } directoryEntry.Dispose(); } } return this.outbound; }
public void CopyTo(ReplicationConnection[] connections, int index) { Contract.Requires(connections != null); Contract.Requires(index >= 0); }
public bool Contains(ReplicationConnection connection) { Contract.Requires(connection != null); return default(bool); }
public int IndexOf (ReplicationConnection connection) { throw new NotImplementedException (); }
internal int Add(ReplicationConnection value) { return InnerList.Add(value); }
public ReplicationConnection(DirectoryContext context, string name, DirectoryServer sourceServer, ActiveDirectorySchedule schedule, ActiveDirectoryTransportType transport) { ReplicationConnection.ValidateArgument(context, name); if (sourceServer != null) { if (transport < ActiveDirectoryTransportType.Rpc || transport > ActiveDirectoryTransportType.Smtp) { throw new InvalidEnumArgumentException("value", (int)transport, typeof(ActiveDirectoryTransportType)); } else { context = new DirectoryContext(context); this.ValidateTargetAndSourceServer(context, sourceServer); this.context = context; this.connectionName = name; this.transport = transport; DirectoryEntry directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE); try { try { string propertyValue = (string)PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ServerName); string str = string.Concat("CN=NTDS Settings,", propertyValue); directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, str); string escapedPath = string.Concat("cn=", this.connectionName); escapedPath = Utils.GetEscapedPath(escapedPath); this.cachedDirectoryEntry = directoryEntry.Children.Add(escapedPath, "nTDSConnection"); DirectoryContext directoryContext = sourceServer.Context; directoryEntry = DirectoryEntryManager.GetDirectoryEntry(directoryContext, WellKnownDN.RootDSE); string propertyValue1 = (string)PropertyManager.GetPropertyValue(directoryContext, directoryEntry, PropertyManager.ServerName); propertyValue1 = string.Concat("CN=NTDS Settings,", propertyValue1); this.cachedDirectoryEntry.Properties["fromServer"].Add(propertyValue1); if (schedule != null) { this.cachedDirectoryEntry.Properties["schedule"].Value = schedule.GetUnmanagedSchedule(); } string dNFromTransportType = Utils.GetDNFromTransportType(this.TransportType, context); directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, dNFromTransportType); try { //TODO: REVIEW: URGENT!!: directoryEntry.Bind(true); } catch (COMException cOMException1) { COMException cOMException = cOMException1; if (cOMException.ErrorCode == -2147016656) { DirectoryEntry directoryEntry1 = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE); if (Utils.CheckCapability(directoryEntry1, Capability.ActiveDirectoryApplicationMode) && transport == ActiveDirectoryTransportType.Smtp) { throw new NotSupportedException(Res.GetString("NotSupportTransportSMTP")); } } throw ExceptionHelper.GetExceptionFromCOMException(context, cOMException); } this.cachedDirectoryEntry.Properties["transportType"].Add(dNFromTransportType); this.cachedDirectoryEntry.Properties["enabledConnection"].Value = false; this.cachedDirectoryEntry.Properties["options"].Value = 0; } catch (COMException cOMException3) { COMException cOMException2 = cOMException3; throw ExceptionHelper.GetExceptionFromCOMException(context, cOMException2); } } finally { directoryEntry.Close(); } return; } } else { throw new ArgumentNullException("sourceServer"); } }