473,322 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

VB DirectoryService Guru... HELP???

Can someone please help!

I am trying to use DirectoryServices with a datagrid to show the different
users in our AD and then have a button that will show the details of the
selected user and give the ability to edit the users details!

I'm having a problem getting the users details to show up when you click a
button in the datagrid and would really appritiate help solving this...

The following article gives some guidance but it is in C#!
http://www.wimdows.net/articles/article.aspx?aid=13
Thanks...

...Inlinecode

<asp:ButtonColumn Text="<img border=0 src=../images/properties.gif alt=Page
Properties>" CommandName="dgADUserInfo_SelectedIndexChanged()">
<ItemStyle ForeColor="#3300FF"></ItemStyle>
</asp:ButtonColumn>

....Codebehind..
Sub GetUserADInfo()
Dim strADPath As String
strADPath = "netdomain.domain.dk"

Dim Entry As DirectoryEntry = New DirectoryEntry("LDAP://" &
strADPath, "administrator", "xxxxxx")
' Create a DirectorySearcher object.
Dim mySearcher As New DirectorySearcher(Entry)
' Use the FindOne method to find the object, which in this case, is
the user
' indicated by User Name and assign it to a SearchResult.
mySearcher.Filter = ("(&(objectCategory=person)(objectClass=user))" )
'Dim MySearchResult As SearchResult = mySearcher.FindOne
Dim results As SearchResultCollection

results = mySearcher.FindAll()
dgADUserInfo.DataSource = results
dgADUserInfo.DataBind()

End Sub
Sub dgADUserInfo_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As DataGridCommandEventArgs)

Dim strADPath As String
strADPath = "netdomain.domain.dk"

Dim Entry As DirectoryEntry = New DirectoryEntry("LDAP://" &
strADPath, "administrator", "xxxxxx")
' Create a DirectorySearcher object.
Dim mySearcher As New DirectorySearcher(Entry)
' Use the FindOne method to find the object, which in this case,
is the user
' indicated by User Name and assign it to a SearchResult.
mySearcher.Filter =
("(&(objectCategory=person)(objectClass=user))(Nam e=dgADUserInfo.SelectedItem.Cells[1].Text))")

Dim result As Object
For Each result In mySearcher.FindAll()
TextBox1.Text = result.GetDirectoryEntry().Name

' Dim myEnumerator As IDictionaryEnumerator =
result.Properties.GetEnumerator()
' While myEnumerator.MoveNext()
' Console.WriteLine("{0}: {1}", myEnumerator.Key,
myEnumerator.Value)
'End While
Next
End Sub
Nov 19 '05 #1
0 906

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

Similar topics

2
by: rmn | last post by:
Hi, I'm looking for the translation betwen the color spaces, but I must be mistaken with the methods to use, losing the values. Please, I need a little help of a "coloured guru"....
4
by: Accolo1 | last post by:
Help we are looking for this person, do you know them? William wjohnson@accolo.com Title: BEA WebLogic Portal Guru Job #: 03-04468 Check the pulse of your career! Evolve our eCommerce web...
0
by: Justin Rich | last post by:
I would like to find a way to use the data grid to hook in to the AD. Was looking at the choices for data sources and i didnt see a way to do it, but figured i would ask to see if i missed...
6
by: trint | last post by:
The WritePrinter() is working. I know this ReadPrinter() implementation isn't correct because it never reads into "reaDstrinG" buffer from the printer...But, I'm sure one of you Guru's do know how...
0
by: Tim::.. | last post by:
Question 1... Hi can someone please tell me why I can't put the following LDAP string into my web.config fill as an <appSetting> <appSettings> <add key="strLDAP"...
5
by: Tim::.. | last post by:
Hi can someone please tell me how I change this directory service query so that it searches through each record in the active directory and returns all the accounts! At the moment I can only get...
0
by: Curt | last post by:
If you are a guru in VB 2005 and have worked with Crystal Reports. I need to hire you to help me. Please email me at CurtTampa at my gmail account. I am ONLY Interested if you are in the Tampa FL...
16
by: Singulus | last post by:
Hello all, I've searched for similar threads, I've found some bit of useful info here and there, but nevertheless I want to post my questions...So, how can I (we, in fact the forum can benefit...
1
by: stevenjs | last post by:
Greeings, all, Flash 8 has quiz templates which are coded for multiple choice, true/false, text statement, and matching types of questions, along with hotspots and probably anoher type I am...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.