Re: Get list of the Groups a User belongs to
- From: "Dave Sexton" <dave@jwa[remove.this]online.com>
- Date: Sat, 9 Dec 2006 07:51:50 -0500
Hi,
On a Windows Server 2003 domain you can construct a WindowsIdentity by
passing in the user's name in the form, name@domain:
"WindowsIdentity(String) Constructor"
http://msdn2.microsoft.com/en-us/library/td3046fc.aspx
Then you can access the Groups property (2.0 framework only):
"WindowsIdentity.Groups Property"
http://msdn2.microsoft.com/en-us/library/system.security.principal.windowsidentity.groups.aspx
If you can't use the above solution since you are using a different version
of the framework or a different domain then I think you'll have to resort to
the unmanaged APIs such as LogonUser:
"LogonUser"
http://msdn2.microsoft.com/en-us/library/aa378184.aspx
The above will get you the User's token, which you can pass to the following
function:
"GetTokenInformation"
http://msdn2.microsoft.com/en-us/library/aa446671.aspx
Specify the value of TOKEN_GROUPS for the TokenInformationClass argument.
(Note that I haven't used these APIs myself)
You'll have to use P/Invoke for this, of course :)
--
Dave Sexton
"Jeff Williams" <jeff.williams@xxxxxxxxxxxxxxx> wrote in message
news:12nl6l665t0o610@xxxxxxxxxxxxxxxxxxxxx
How can I get a list of the Groups both Local and Domain groups a User
belongs to.
.
- Follow-Ups:
- Re: Get list of the Groups a User belongs to
- From: Mark Rae
- Re: Get list of the Groups a User belongs to
- References:
- Get list of the Groups a User belongs to
- From: Jeff Williams
- Get list of the Groups a User belongs to
- Prev by Date: Re: Public information
- Next by Date: Re: Public information
- Previous by thread: Get list of the Groups a User belongs to
- Next by thread: Re: Get list of the Groups a User belongs to
- Index(es):
Relevant Pages
|