0

C# プロジェクトの短いクエストがあります。Active Directory を読み込んで、これを使用したい:

System.DirectoryServices.DirectorySearcher mySearcher = new System.DirectoryServices.DirectorySearcher(entry);

foreach (System.DirectoryServices.SearchResult resEnt in mySearcher.FindAll())
{
        System.DirectoryServices.DirectoryEntry de = resEnt.GetDirectoryEntry();
        try
        {
            myRow["eMail"] = de.Properties["Mail"].Value.ToString();
        }
        catch (Exception)
        { }
}

ここで、他のプロパティを読み上げたいと思います。すべてのプロパティのリストを教えていただければ幸いです。

ありがとう

4

1 に答える 1

8

以下のコードで簡単に実行できます

 DirectorySearcher mySearcher = new System.DirectoryServices.DirectorySearcher(entry);

            foreach (System.DirectoryServices.SearchResult resEnt in mySearcher.FindAll())
            {
                try
                {
                    foreach (string property in resEnt.Properties.PropertyNames)
                    {
                        string value = resEnt.Properties[property][0].ToString();

                        Console.WriteLine(property + ":" + value);
                    }
                }
                catch (Exception)
                { }
            }
于 2013-07-27T04:50:43.713 に答える