J
jmDesktop
Can someone tell me why I get this error?
System.DirectoryServices.DirectoryServicesCOMException was unhandled
Message="An operations error occurred.\r\n"
Source="System.DirectoryServices"
ErrorCode=-2147016672
ExtendedError=8406
ExtendedErrorMessage="000020D6: SvcErr: DSID-03100684, problem 5012
(DIR_ERROR), data 0\n"
From:
private void Form1_Load(object sender, EventArgs e)
{
DirectoryEntry group = new DirectoryEntry("LDAP://CN=MyDomain"); //
represents your group you wish to look at
using (group)
{
DirectorySearcher ds = new DirectorySearcher(
group,
"(&(objectClass=user)(objectCategory=person))", //only
retrieve user objects
new string[]{"sAMAccountName"}
);
//the part the you really need to do is next two lines
ds.SearchScope = SearchScope.Base;
ds.AttributeScopeQuery = "member";
using (SearchResultCollection src = ds.FindAll())
{
foreach (SearchResult sr in src)
sr.Properties["sAMAccountName"][0].ToString();
}
}
}
}
System.DirectoryServices.DirectoryServicesCOMException was unhandled
Message="An operations error occurred.\r\n"
Source="System.DirectoryServices"
ErrorCode=-2147016672
ExtendedError=8406
ExtendedErrorMessage="000020D6: SvcErr: DSID-03100684, problem 5012
(DIR_ERROR), data 0\n"
From:
private void Form1_Load(object sender, EventArgs e)
{
DirectoryEntry group = new DirectoryEntry("LDAP://CN=MyDomain"); //
represents your group you wish to look at
using (group)
{
DirectorySearcher ds = new DirectorySearcher(
group,
"(&(objectClass=user)(objectCategory=person))", //only
retrieve user objects
new string[]{"sAMAccountName"}
);
//the part the you really need to do is next two lines
ds.SearchScope = SearchScope.Base;
ds.AttributeScopeQuery = "member";
using (SearchResultCollection src = ds.FindAll())
{
foreach (SearchResult sr in src)
sr.Properties["sAMAccountName"][0].ToString();
}
}
}
}