Discussion:
getting user name from active directory
(too old to reply)
Joanne
2007-08-22 18:44:01 UTC
Permalink
Hello,
I'd like to be able to grab the user first name and last name from Active
Directory, to place in a form I've created. I'm not sure what kind of
connection to set up.

Thank you for any help you can provide.
Jean-Guy Marcil
2007-08-26 22:41:56 UTC
Permalink
Post by Joanne
Hello,
I'd like to be able to grab the user first name and last name from
Active Directory, to place in a form I've created. I'm not sure what
kind of connection to set up.
Thank you for any help you can provide.
See this thread for more info:
http://tinyurl.com/2owxbh

Here is something to get you going:

Dim objAdSys, objUser
Set objAdSys = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & objAdSys.UserName)

MsgBox (objUser.Get("cn"))
MsgBox (objUser.Get("distinguishedName"))
MsgBox (objUser.Get("displayName"))
MsgBox (objUser.Get("initials"))
MsgBox (objUser.Get("mail"))
MsgBox (objUser.Get("department"))
MsgBox (objUser.Get("company"))
MsgBox (objUser.Get("title"))
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
***@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Joanne
2007-08-27 12:48:05 UTC
Permalink
Merci!
Vous etes un ange!
Post by Jean-Guy Marcil
Post by Joanne
Hello,
I'd like to be able to grab the user first name and last name from
Active Directory, to place in a form I've created. I'm not sure what
kind of connection to set up.
Thank you for any help you can provide.
http://tinyurl.com/2owxbh
Dim objAdSys, objUser
Set objAdSys = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & objAdSys.UserName)
MsgBox (objUser.Get("cn"))
MsgBox (objUser.Get("distinguishedName"))
MsgBox (objUser.Get("displayName"))
MsgBox (objUser.Get("initials"))
MsgBox (objUser.Get("mail"))
MsgBox (objUser.Get("department"))
MsgBox (objUser.Get("company"))
MsgBox (objUser.Get("title"))
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
Word MVP site: http://www.word.mvps.org
Jean-Guy Marcil
2007-08-28 01:14:34 UTC
Permalink
Post by Joanne
Merci!
Vous etes un ange!
I know... If only I could convince my wife of the same!
;-)

Glad I could help.
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
***@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Continue reading on narkive:
Loading...