Hi,
I am trying to build Filter expression of ActiveDirectory searcher. I found the following code in an article on CodeProject site but I don't seem to know what to use for my case.
Here is the syntax of the Filter they have:
mySearcher.Filter = "(&(objectClass=user)
(|(cn=" + objectName + ")(sAMAccountName=" + objectName + ")))";
What I don't understand is the following:
1. Do I need to change the value of "cn"? Or this is a constant?
2. What value should I substitue for objectName?
3. What value to substitute in place of "sAMAccountName"?
Thank you in advance for your help.
UPDATE: I found even simpler Filter expression, as following:
mySearcher.Filter = "(SAMAccountName=" + username + ")";
I seem to see the value "SAMAccountName in more than one article. Is this a constant that I should use as is?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham