473,471 Members | 4,625 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

VB.NET & Active Directory

Does anyone know how to list every group that a user is a member of using the System.DirectoryServices namespace

I appreciate your help
Nov 20 '05 #1
1 1222
'get path to AD users from web.config file
Dim rootUser As New
DirectoryEntry(System.Configuration.ConfigurationS ettings.AppSettings("ADUse
rsPath"))

'Search for user in LDAP root path
Dim ds As New DirectorySearcher(rootUser,
"(&(objectClass=user)(samAccountName=" & UserName & "))")

'return these values only
ds.PropertiesToLoad.Add("mail")
ds.PropertiesToLoad.Add("NativeGuid")
ds.PropertiesToLoad.Add("MemberOf")
ds.PropertiesToLoad.Add("FullName")

'execute the search and return one result
Dim sr As SearchResult = ds.FindOne()

For Each obj As String In sr.Properties("memberOf")
'look up each object
Dim group As New DirectoryEntry("LDAP://" & obj)
'store guid in array
Guid = group.NativeGuid
Next
Hope it helps,
Cheers... Lubos

"Reese" <an*******@discussions.microsoft.com> wrote in message
news:57**********************************@microsof t.com...
Does anyone know how to list every group that a user is a member of using the System.DirectoryServices namespace?
I appreciate your help

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Vamsi | last post by:
Hi Guys, I have installed Visual Studio.Net on my windows XP machine. First after installing all the required WCU, then installed the Visual Studio.Net. All set up was completed...
0
by: Enigma Webmaster | last post by:
Hi All, We have written a set of functions to retrieve the current userlist from Active Directory and it works just fine. (We did have a few problems with the Address field, but we've cheated...
2
by: James Allan | last post by:
Hello -- I'm trying to get SQL Server 2000 on a Windows 2000 Server to be able to query an Active Directory. We've got two domain servers one Win2000 and one Win2003. However, I'm having...
0
by: Shri | last post by:
hi i am new to active directory and stuff can some one please help me in finding all "sites" and "subnets" from active directory using C#.net thanks in advance red
1
by: Jim in Arizona | last post by:
I've built a small IT helpdesk ticket system using the .NET 2.0 Beta 2 framework w/VS 2005 Beta 2. This system sits on an IIS 5.0 server, fully patched. The IIS server is set for windows inegrated...
3
by: Demetri | last post by:
Hello, My company has charged me with creating a web service that will validate a user and return the user's roles via Active Directory. The requirement is that the web service must return...
5
by: Terry Holland | last post by:
I have an intranet application that comprises an ASP.Net application connecting to a SQL Server DB The application has 150 users. At the moment I am connecting using the following setup I have...
0
by: mduff | last post by:
This is actually a great script that will help authenticate your username and password within your domain. One thing I would correct is directly above the line that indicates: Set oADsObject =...
1
by: Tim | last post by:
Folks, I have 3 loosely linked problems which I am would appreciate feedback on. 1). T-Sql and Active directory roles. We want to be able to control access to data within a table based on a...
5
by: Mark B | last post by:
Hi experts, I'm converting a homebrew AD management progam I wrote, from VB6 to VB 2008. I've got some code that sticks values in to Active Directory like this:- objOU.PutEx...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.