Read() public static method

Synchronously reads the entry specified by the Ldap URL. When this read method is called, a new connection is created automatically, using the host and port specified in the URL. After finding the entry, the method closes the connection (in other words, it disconnects from the Ldap server). If the URL specifies a filter and scope, they are not used. Of the information specified in the URL, this method only uses the Ldap host name and port number, the base distinguished name (DN), and the list of attributes to return.
LdapException if the object was not found ///
public static Read ( LdapUrl toGet ) : LdapEntry
toGet LdapUrl Ldap URL specifying the entry to read. /// ///
return LdapEntry
示例#1
0
    // findACLValues() reads the entry to get it's ACL values
    public static void findACLValues(LdapConnection lc, String entry)
    {
        String[] returnAttrs = { "acl" };
        String attributeName;
        IEnumerator allValues;
        LdapAttribute attribute;
        LdapAttributeSet attributeSet;

        try
        {
            LdapEntry aclList = lc.Read( entry, returnAttrs );

            // printout entryDN's ACL values
            attributeSet = aclList.getAttributeSet();
            IEnumerator allAttributes = attributeSet.GetEnumerator();

            Console.WriteLine("    =========================================");
            Console.WriteLine("    entryDN's ACL values after modification:");
            Console.WriteLine("    =========================================");
            if (allAttributes.MoveNext())
            {
                attribute = (LdapAttribute)allAttributes.Current;
                attributeName = attribute.Name;
                allValues = attribute.StringValues;
                while(allValues.MoveNext())
                {
                    PrintACLValue((String)allValues.Current);
                }
            }
        }
        catch( LdapException e )
        {
            Console.WriteLine( "Error: ModdifyACL, " + e.ToString() );
            Environment.Exit(1);
        }
    }
示例#2
0
		/// <summary> Synchronously reads the entry specified by the Ldap URL, using the
		/// specified constraints.
		/// 
		/// When this method is called, a new connection is created
		/// automatically, using the host and port specified in the URL. After
		/// finding the entry, the method closes the connection (in other words,
		/// it disconnects from the Ldap server).
		/// 
		/// If the URL specifies a filter and scope, they are not used. Of the
		/// information specified in the URL, this method only uses the Ldap host
		/// name and port number, the base distinguished name (DN), and the list
		/// of attributes to return.
		/// 
		/// </summary>
		/// <returns> The entry specified by the base DN.
		/// 
		/// </returns>
		/// <param name="toGet">      Ldap URL specifying the entry to read.
		/// 
		/// </param>
		/// <param name="cons">      Constraints specific to the operation.
		/// 
		/// </param>
		/// <exception> LdapException if the object was not found
		/// </exception>
		public static LdapEntry Read(LdapUrl toGet, LdapSearchConstraints cons)
		{
			LdapConnection lconn = new LdapConnection();
			lconn.Connect(toGet.Host, toGet.Port);
			LdapEntry toReturn = lconn.Read(toGet.getDN(), toGet.AttributeArray, cons);
			lconn.Disconnect();
			return toReturn;
		}