示例#1
0
        static void Main(string[] args)
        {
            Uri uri        = new Uri("http://dsmlserver/dsml");
            var identifier = new DsmlDirectoryIdentifier(uri);

            var credentials = new NetworkCredential();

            credentials.UserName = "******";
            credentials.Password = "******";
            credentials.Domain   = "explorer";

            var dsmlConnection = new DsmlSoapHttpConnection(identifier, credentials);

            string distinguishedName = null;
            string ldapFilter        = "(objectClass=user)";

            string[] attributesToReturn = null;// return all attributes

            var searchRequest = new SearchRequest(distinguishedName,
                                                  ldapFilter, SearchScope.Subtree, attributesToReturn);

            SearchResponse searchResponse = (SearchResponse)dsmlConnection.SendRequest(searchRequest);

            Console.WriteLine("\r\nSearch matched {0} entries:", searchResponse.Entries.Count);
            foreach (SearchResultEntry entry in searchResponse.Entries)
            {
                Console.WriteLine(entry.DistinguishedName);

                // retrieve a specific attribute
                DirectoryAttribute attribute = entry.Attributes["ou"];
                Console.WriteLine("{0} = {1}", attribute.Name, attribute[0]);

                // retrieve all attributes
                foreach (DirectoryAttribute attr in entry.Attributes.Values)
                {
                    Console.Write("{0}=", attr.Name);

                    // retrieve all values for the attribute
                    // the type of the value can be one of string, byte[] or Uri
                    foreach (object value in attr)
                    {
                        Console.Write("{0} ", value);
                    }
                    Console.WriteLine();
                }
            }
        }
	public DsmlSoapHttpConnection(DsmlDirectoryIdentifier identifier, System.Net.NetworkCredential credential, AuthType authType) {}
	public DsmlSoapHttpConnection(DsmlDirectoryIdentifier identifier) {}
示例#4
0
 public DsmlSoapHttpConnection(DsmlDirectoryIdentifier identifier)
 {
 }
示例#5
0
 public DsmlSoapHttpConnection(DsmlDirectoryIdentifier identifier, System.Net.NetworkCredential credential, AuthType authType)
 {
 }