Novell.Directory.Ldap.LdapConnection.Read C# (CSharp) Method

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
        public static LdapEntry Read(LdapUrl toGet)
        {
            LdapConnection lconn = new LdapConnection();
            lconn.Connect(toGet.Host, toGet.Port);
            LdapEntry toReturn = lconn.Read(toGet.getDN(), toGet.AttributeArray);
            lconn.Disconnect();
            return toReturn;
        }

Same methods

LdapConnection::Read ( LdapUrl toGet, LdapSearchConstraints cons ) : LdapEntry
LdapConnection::Read ( System dn ) : LdapEntry
LdapConnection::Read ( System dn, LdapSearchConstraints cons ) : LdapEntry
LdapConnection::Read ( System dn, System attrs ) : LdapEntry
LdapConnection::Read ( System dn, System attrs, LdapSearchConstraints cons ) : LdapEntry

Usage Example

Example #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);
        }
    }
All Usage Examples Of Novell.Directory.Ldap.LdapConnection::Read