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

Error when trying to execute IADsUser.Groups()

0 views
Skip to first unread message

Kenneth Courville

unread,
Aug 20, 2002, 4:45:00 PM8/20/02
to
Need... help...

I'm trying to read the groups that a user belongs to. This is for an
application running in ASP.NET, but I think my problem is with AD.
Here's my code:

///////////////////////////////////////////////////
DirectoryEntry aduser =
new DirectoryEntry( _path, username, pwd);

object groups = aduser.Invoke("Groups");

// ^-- causes error "Exception has been thrown by the
// target of an invocation."
///////////////////////////////////////////////////

Where "_path" is the distinguished name of the user, "username" and
"pwd" are the username and password of a domain user (I've tried the
domain administrator account, too, to rule out permissions issues).

I'm pretty sure that the problem is not from my DirectoryEntry
parameters as I'm able to retrieve other Properties from my aduser once
created.

I've also tried this method with a more descriptive error:
////////////////////////////////////////////////
DirectoryEntry aduser =
new DirectoryEntry( this._path, username, pwd);

IADsUser user = aduser.NativeObject as IADsUser;

object groups = user.Groups();
// ^-- returns error "Exception from HRESULT: 0x8000500C."
////////////////////////////////////////////////

----------------------------------------
http://members.tripod.com/kcourville0/


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Willy Denoyette [MVP]

unread,
Aug 20, 2002, 5:58:09 PM8/20/02
to
object groups = aduser.Invoke("Groups");
is not valid when using LDAP, try the "memberOf" property in the properties collection of a user entry.
See ADSI docs for deatils...

Willy.

"Kenneth Courville" <kcour...@yahoo.com> wrote in message news:#fJl0pISCHA.2456@tkmsftngp08...

0 new messages