public void AddRange(ActiveDirectorySubnetCollection subnets)
        {
            if (subnets == null)
                throw new ArgumentNullException("subnets");

            int count = subnets.Count;
            for (int i = 0; i < count; i++)
                this.Add(subnets[i]);
        }
        public void AddRange(ActiveDirectorySubnetCollection subnets)
        {
            if (subnets == null)
            {
                throw new ArgumentNullException("subnets");
            }
            int count = subnets.Count;

            for (int i = 0; i < count; i++)
            {
                this.Add(subnets[i]);
            }
        }
 public ActiveDirectorySite(DirectoryContext context, string siteName)
 {
     this.adjacentSites = new ReadOnlySiteCollection();
     this.domains = new DomainCollection(null);
     this.servers = new ReadOnlyDirectoryServerCollection();
     this.links = new ReadOnlySiteLinkCollection();
     this.bridgeheadServers = new ReadOnlyDirectoryServerCollection();
     ValidateArgument(context, siteName);
     context = new DirectoryContext(context);
     this.context = context;
     this.name = siteName;
     DirectoryEntry directoryEntry = null;
     try
     {
         directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
         string str = (string) PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ConfigurationNamingContext);
         this.siteDN = "CN=Sites," + str;
         directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, this.siteDN);
         string escapedPath = Utils.GetEscapedPath("cn=" + this.name);
         this.cachedEntry = directoryEntry.Children.Add(escapedPath, "site");
     }
     catch (COMException exception)
     {
         throw ExceptionHelper.GetExceptionFromCOMException(context, exception);
     }
     catch (ActiveDirectoryObjectNotFoundException)
     {
         throw new ActiveDirectoryOperationException(Res.GetString("ADAMInstanceNotFoundInConfigSet", new object[] { context.Name }));
     }
     finally
     {
         if (directoryEntry != null)
         {
             directoryEntry.Dispose();
         }
     }
     this.subnets = new ActiveDirectorySubnetCollection(context, "CN=" + siteName + "," + this.siteDN);
     string transportName = "CN=IP,CN=Inter-Site Transports," + this.siteDN;
     this.RPCBridgeheadServers = new DirectoryServerCollection(context, "CN=" + siteName + "," + this.siteDN, transportName);
     transportName = "CN=SMTP,CN=Inter-Site Transports," + this.siteDN;
     this.SMTPBridgeheadServers = new DirectoryServerCollection(context, "CN=" + siteName + "," + this.siteDN, transportName);
 }
示例#4
0
		internal ActiveDirectorySite(DirectoryContext context, string siteName, bool existing)
		{
			this.adjacentSites = new ReadOnlySiteCollection();
			this.domains = new DomainCollection(null);
			this.servers = new ReadOnlyDirectoryServerCollection();
			this.links = new ReadOnlySiteLinkCollection();
			this.bridgeheadServers = new ReadOnlyDirectoryServerCollection();
			this.context = context;
			this.name = siteName;
			this.existing = existing;
			DirectoryEntry directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
			this.siteDN = string.Concat("CN=Sites,", (string)PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ConfigurationNamingContext));
			this.cachedEntry = DirectoryEntryManager.GetDirectoryEntry(context, string.Concat("CN=", siteName, ",", this.siteDN));
			this.subnets = new ActiveDirectorySubnetCollection(context, string.Concat("CN=", siteName, ",", this.siteDN));
			string str = string.Concat("CN=IP,CN=Inter-Site Transports,", this.siteDN);
			this.RPCBridgeheadServers = new DirectoryServerCollection(context, (string)PropertyManager.GetPropertyValue(context, this.cachedEntry, PropertyManager.DistinguishedName), str);
			str = string.Concat("CN=SMTP,CN=Inter-Site Transports,", this.siteDN);
			this.SMTPBridgeheadServers = new DirectoryServerCollection(context, (string)PropertyManager.GetPropertyValue(context, this.cachedEntry, PropertyManager.DistinguishedName), str);
		}
示例#5
0
		public ActiveDirectorySite(DirectoryContext context, string siteName)
		{
			this.adjacentSites = new ReadOnlySiteCollection();
			this.domains = new DomainCollection(null);
			this.servers = new ReadOnlyDirectoryServerCollection();
			this.links = new ReadOnlySiteLinkCollection();
			this.bridgeheadServers = new ReadOnlyDirectoryServerCollection();
			ActiveDirectorySite.ValidateArgument(context, siteName);
			context = new DirectoryContext(context);
			this.context = context;
			this.name = siteName;
			DirectoryEntry directoryEntry = null;
			using (directoryEntry)
			{
				try
				{
					directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
					string propertyValue = (string)PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ConfigurationNamingContext);
					this.siteDN = string.Concat("CN=Sites,", propertyValue);
					directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, this.siteDN);
					string escapedPath = string.Concat("cn=", this.name);
					escapedPath = Utils.GetEscapedPath(escapedPath);
					this.cachedEntry = directoryEntry.Children.Add(escapedPath, "site");
				}
				catch (COMException cOMException1)
				{
					COMException cOMException = cOMException1;
					throw ExceptionHelper.GetExceptionFromCOMException(context, cOMException);
				}
				catch (ActiveDirectoryObjectNotFoundException activeDirectoryObjectNotFoundException)
				{
					object[] name = new object[1];
					name[0] = context.Name;
					throw new ActiveDirectoryOperationException(Res.GetString("ADAMInstanceNotFoundInConfigSet", name));
				}
			}
			this.subnets = new ActiveDirectorySubnetCollection(context, string.Concat("CN=", siteName, ",", this.siteDN));
			string str = string.Concat("CN=IP,CN=Inter-Site Transports,", this.siteDN);
			this.RPCBridgeheadServers = new DirectoryServerCollection(context, string.Concat("CN=", siteName, ",", this.siteDN), str);
			str = string.Concat("CN=SMTP,CN=Inter-Site Transports,", this.siteDN);
			this.SMTPBridgeheadServers = new DirectoryServerCollection(context, string.Concat("CN=", siteName, ",", this.siteDN), str);
		}
    public void AddRange(ActiveDirectorySubnetCollection subnets)
    {
      Contract.Requires(subnets != null);

    }
 public void AddRange(ActiveDirectorySubnetCollection subnets)
 {
     throw new NotImplementedException();
 }
示例#8
0
        internal ActiveDirectorySite(DirectoryContext context, string siteName, bool existing)
        {
            Debug.Assert(existing == true);

            this.context = context;
            _name = siteName;
            this.existing = existing;

            DirectoryEntry de = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
            _siteDN = "CN=Sites," + (string)PropertyManager.GetPropertyValue(context, de, PropertyManager.ConfigurationNamingContext);

            cachedEntry = DirectoryEntryManager.GetDirectoryEntry(context, "CN=" + siteName + "," + _siteDN);
            _subnets = new ActiveDirectorySubnetCollection(context, "CN=" + siteName + "," + _siteDN);

            string transportDN = "CN=IP,CN=Inter-Site Transports," + _siteDN;
            _RPCBridgeheadServers = new DirectoryServerCollection(context, (string)PropertyManager.GetPropertyValue(context, cachedEntry, PropertyManager.DistinguishedName), transportDN);
            transportDN = "CN=SMTP,CN=Inter-Site Transports," + _siteDN;
            _SMTPBridgeheadServers = new DirectoryServerCollection(context, (string)PropertyManager.GetPropertyValue(context, cachedEntry, PropertyManager.DistinguishedName), transportDN);
        }
示例#9
0
        public ActiveDirectorySite(DirectoryContext context, string siteName)
        {
            ValidateArgument(context, siteName);

            //  work with copy of the context
            context = new DirectoryContext(context);

            this.context = context;
            _name = siteName;

            // bind to the rootdse to get the configurationnamingcontext
            DirectoryEntry de = null;
            try
            {
                de = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
                string config = (string)PropertyManager.GetPropertyValue(context, de, PropertyManager.ConfigurationNamingContext);
                _siteDN = "CN=Sites," + config;
                // bind to the site container
                de = DirectoryEntryManager.GetDirectoryEntry(context, _siteDN);

                string rdn = "cn=" + _name;
                rdn = Utils.GetEscapedPath(rdn);
                cachedEntry = de.Children.Add(rdn, "site");
            }
            catch (COMException e)
            {
                throw ExceptionHelper.GetExceptionFromCOMException(context, e);
            }
            catch (ActiveDirectoryObjectNotFoundException)
            {
                // this is the case where the context is a config set and we could not find an ADAM instance in that config set
                throw new ActiveDirectoryOperationException(Res.GetString(Res.ADAMInstanceNotFoundInConfigSet, context.Name));
            }
            finally
            {
                if (de != null)
                    de.Dispose();
            }

            _subnets = new ActiveDirectorySubnetCollection(context, "CN=" + siteName + "," + _siteDN);
            string transportDN = "CN=IP,CN=Inter-Site Transports," + _siteDN;
            _RPCBridgeheadServers = new DirectoryServerCollection(context, "CN=" + siteName + "," + _siteDN, transportDN);
            transportDN = "CN=SMTP,CN=Inter-Site Transports," + _siteDN;
            _SMTPBridgeheadServers = new DirectoryServerCollection(context, "CN=" + siteName + "," + _siteDN, transportDN);
        }
 public void AddRange(ActiveDirectorySubnetCollection subnets)
 {
     Contract.Requires(subnets != null);
 }
		public void AddRange (ActiveDirectorySubnetCollection subnets)
		{
			throw new NotImplementedException ();
		}