简体   繁体   中英

How to pass a variable into the searchResult.Properties[] for the DirectoryServices class

I am running an active directory search and can get results with the following code (the code is in C# - I am using System.DirectoryServices):

foreach (SearchResult searchResult in searchResults)
        {
            foreach (var detailresult1 in searchResult.Properties[ipPhone])
            {
                arrayresult1[i] = detailresult1.ToString();
                i++;
            }
         }

Now, I would like to replace ipPhone with a variable that I have set up in an XML file. The purpose for this is that the user can change the variables he/she wants displayed by changing the XML file.

For example, the XML file may be changed from ipPhone to mail, so that the email address is shown.

How do you pass a variable into that statement?

只需将XLM变量传递到文本框即可。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM