|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
|
As Bob pointed out, the WinNT provider doesn't have a EmailAddress
property for user objects. If you want to retrieve users from AD, you should bind to the container using LDAP. Example: Set UserContainer = GetObject("LDAP://ou=users,dc=mydomain,dc=net") Call UserContainer.GetInfo UserContainer.Filter = Array("user") For Each MyUser In UserContainer MsgBox MyUser.mailAddress Next This will enumerate users in the "users" OU of mydomain.net. Also, may I recommend a great resource called the Technet Script Center: [url]http://www.microsoft.com/technet/community/scriptcenter/default.mspx[/url] (look in the repository under "Users and Groups") It's all VBScript code, but that can easily be converted to "true" VB. -- Björn Holmgren "Chris Jones" <ChrisJones@discussions.microsoft.com> wrote in message news:CBF6E486-E2F6-4B0F-BB4B-663AB2123441@microsoft.com... > Sorry if this is OT, but I'm not sure where to post an Active Directory > question. > In VB 6, When I call AD for a list of users, and iterate through the > list, I can view the user's name, but little else. If I try to read their > EmailAddress (for example) I get a runtime error saying "The Directory > Property Cannot be Found in the Cache." > What am I doing wrong? > > Here's my code: > Public Sub UserInfo(LoginName As String, result As String) > Dim UserContainer As IADsContainer > Dim MyUser As IADsUser > Dim MyObj As IADsContainer > > Set UserContainer = GetObject("WinNT://Progressivex") > > Call UserContainer.GetInfo > UserContainer.Filter = Array("user") > For Each MyUser In UserContainer > MsgBox (MyUser.EmailAddress) > Next MyUser > End Sub |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|