Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Return all users who are present in a group - followup

2 views
Skip to first unread message

Iain

unread,
Nov 13, 2009, 7:11:29 AM11/13/09
to
All,

The code below returns the following error :

"There is no such object on the server."

string LDAPAddress = "LDAP://mydomain/CN=grouptosearchfor
members,dc=mydomain,DC=co,DC=uk";
DirectoryEntry mygroup = new DirectoryEntry(LDAPAddress);
string groupMembers = "";
foreach (object dn in mygroup.Properties["member"]) <---------here
{
// get names here...
}

Any suggestions/ideas would be great.

TIA
Ian

Joe Kaplan

unread,
Nov 13, 2009, 9:32:21 AM11/13/09
to
Instead of trying to specify the path the group (which appears to be wrong
here), why don't you use the DirectorySearcher to search for the group by CN
using the domain root as the path and then read the members from there?

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
"Iain" <ia...@test.co.uk> wrote in message
news:e827vpFZ...@TK2MSFTNGP02.phx.gbl...

Gerry Hickman

unread,
Nov 13, 2009, 2:36:37 PM11/13/09
to
Iain wrote:
> All,
>
> The code below returns the following error :
>
> "There is no such object on the server."
>
> string LDAPAddress = "LDAP://mydomain/CN=grouptosearchfor
> members,dc=mydomain,DC=co,DC=uk";

I don't think that string would ever work; you'd need to include the OU
or CN of the container where the group resides.

> DirectoryEntry mygroup = new DirectoryEntry(LDAPAddress);
> string groupMembers = "";
> foreach (object dn in mygroup.Properties["member"]) <---------here
> {
> // get names here...
> }
>
> Any suggestions/ideas would be great.
>
> TIA
> Ian


--
Gerry Hickman (London UK)

0 new messages