By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,480 Members | 1,146 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,480 IT Pros & Developers. It's quick & easy.

Accessing an AD Group

P: n/a
The below works when the first parameter to DirectoryEntry is set to our
corporate AD domain, such as LDAP://FORD. But if I try for a group within
the domain, such as LDAP://FORD/TRUCKS, I get the error message
"an invalid dn syntax has been specified".
What is the syntax to look at a group?
Thanks, Mark

adEntry = new DirectoryEntry(corpDomain, "SE0017", "IAMsense1",
AuthenticationTypes.Secure);
adSearch = new System.DirectoryServices.DirectorySearcher(adEntry );
adSearch.Filter = ("(anr="+userAccount+")");
try
{
adResult=adSearch.FindOne();
searchCount = adResult.Properties.Values.Count;
}

The below works when the first parameter (cordDomain) to DirectoryEntry is
set to our corporate AD domain, such as LDAP://FORD. But if I try for a
group within the domain, such as LDAP://FORD/TRUCKS, I get the error message
"an invalid dn syntax has been specified".
What is the syntax to look at a group?
Thanks, Mark

adEntry = new DirectoryEntry(corpDomain, "SE0017", "IAMsense1",
AuthenticationTypes.Secure);
adSearch = new System.DirectoryServices.DirectorySearcher(adEntry );
adSearch.Filter = ("(anr="+userAccount+")");
try
{
adResult=adSearch.FindOne();
searchCount = adResult.Properties.Values.Count;
}

P.S. "FORD" is just being used for an example.
Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Please consult the AD/ADSI documentation is MSDN for the correct AD or LDAP
syntax before you start using DirectoryServices.

Willy.
"MarkAurit" <Ma*******@discussions.microsoft.com> wrote in message
news:3C**********************************@microsof t.com...
The below works when the first parameter to DirectoryEntry is set to our
corporate AD domain, such as LDAP://FORD. But if I try for a group within
the domain, such as LDAP://FORD/TRUCKS, I get the error message
"an invalid dn syntax has been specified".
What is the syntax to look at a group?
Thanks, Mark

adEntry = new DirectoryEntry(corpDomain, "SE0017", "IAMsense1",
AuthenticationTypes.Secure);
adSearch = new System.DirectoryServices.DirectorySearcher(adEntry );
adSearch.Filter = ("(anr="+userAccount+")");
try
{
adResult=adSearch.FindOne();
searchCount = adResult.Properties.Values.Count;
}

The below works when the first parameter (cordDomain) to DirectoryEntry is
set to our corporate AD domain, such as LDAP://FORD. But if I try for a
group within the domain, such as LDAP://FORD/TRUCKS, I get the error
message
"an invalid dn syntax has been specified".
What is the syntax to look at a group?
Thanks, Mark

adEntry = new DirectoryEntry(corpDomain, "SE0017", "IAMsense1",
AuthenticationTypes.Secure);
adSearch = new System.DirectoryServices.DirectorySearcher(adEntry );
adSearch.Filter = ("(anr="+userAccount+")");
try
{
adResult=adSearch.FindOne();
searchCount = adResult.Properties.Values.Count;
}

P.S. "FORD" is just being used for an example.

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.