Thank you a lot Richard.
It works. This news group really works!
--
Greetings,
Omar Rodríguez
Telecomunications Analyst & Programmer
VoiceTeam
"Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in
message news:Oo2pv5c6JHA.1416@xxxxxx
Quote:
> Omar Rodríguez wrote:
> Quote:
>> Could you please send me a sample script, about how get the user
>> telephone field from active directory?
>>
>> We have Windows 2003 and the users are using XP.
>>
>> We need the user telefhone number from active directory in order to
>> configure the softphone at user logon.
>> Thank you in advance.
>>
>
> An example to retrieve the telephone number of the current user:
> =========
> Set objSysInfo = CreateObject("ADSystemInfo")
> Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
> strPhone = objUser.telephoneNumber
> Call MsgBox("Your telephone number in Active Directory is " & strPhone)
> ======
> To retrieve for another specified user, then change the number and save,
> the code could be similar to:
> ======
> ' Bind to user using Distinguished Name.
> Set objUser = GetObject("LDAP://cn=Jim Smith,ou=West,dc=MyDomain,dc=com")
> ' Retrieve telephone Number.
> strPhone = objUser.telephoneNumber
> ' Display.
> Call MsgBox("Old telephone number is " & strPhone)
> ' Assign a new number.
> objUser.telephoneNumber = "123-456-3451"
> ' Save changes.
> objUser.SetInfo
> ====
> Does this help?
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>