deshaw
asked on
Get the contact information using userid
Hi,
I have an user id. Could any one please help me to get contact info(like Home phone number, Mobile number, address) using this user id. When I double click on user id, I get an attached info dialog. Basically we need to fetch this infor.
Thanks.
I have an user id. Could any one please help me to get contact info(like Home phone number, Mobile number, address) using this user id. When I double click on user id, I get an attached info dialog. Basically we need to fetch this infor.
Thanks.
All that information is from Active Directory. Write a VB script to extract and display the information you need. See MSDN for a list of all the attributes:
http://msdn.microsoft.com/en-us/library/ms675085(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms675085(VS.85).aspx
Hi, deshaw.
Here's a sample bit of VBScript showing how to do this.
Here's a sample bit of VBScript showing how to do this.
Set rsDetails = Wscript.CreateObject("ADODB.Recordset")
rsDetails.ActiveConnection = "Provider=ADSDSOObject"
'Replace DomainName on the following line with the name of your domain and jdoe with the account name you want to search for'
rsDetails.Source = "SELECT ADsPath, displayName, Company, Department, Division FROM 'LDAP://DomainName' WHERE objectClass='user' AND objectCategory='Person' AND samAccountName='jdoe'"
rsDetails.CursorType = 0
rsDetails.CursorLocation = 2
rsDetails.LockType = 1
rsDetails.Open()
If Not rsDetails.EOF Then
With rsDetails
Wscript.Echo "Name=" & .Fields("displayName") & " Company=" & .Fields("Company") & " Department=" & .Fields("Department") & " Division=" & .Fields("Division")
End With
End If
rsDetails.Close
Set rsDetails = Nothing
ASKER
Thanks Shallwin and BlueDavilFan for your replies but I didnot get any VBA example on that page. Could you please point me if any example?
BlueDavilFan, Can we convert this VBScript to VBA macro?
Thanks.
BlueDavilFan, Can we convert this VBScript to VBA macro?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
BluDevilFan, what is the type of " rsDetails" variable. Macro giving a syntax error at rsDetails.Open()
Thanks.
Thanks.
Sorry, I missed one instance of WScript in the code. Change line 2 to
Set rsDetails = CreateObject("ADODB.Record set")
Set rsDetails = CreateObject("ADODB.Record
ASKER
Thats cool and also we will need to change rsDetails.Open() to rsDetails.Open. :)
BlueDevilFan, Could you please help me on https://www.experts-exchange.com/questions/24280082/register-Outlook-COM-Add-in-in-HKLM.html
I think you know the complete problem I faced while writing my first Add-in :) Now problem is narrow down to creating registry entries. Alternatively, it is also fine if I could register Add-in dll as normal user.
Thanks.
BlueDevilFan, Could you please help me on https://www.experts-exchange.com/questions/24280082/register-Outlook-COM-Add-in-in-HKLM.html
I think you know the complete problem I faced while writing my first Add-in :) Now problem is narrow down to creating registry entries. Alternatively, it is also fine if I could register Add-in dll as normal user.
Thanks.
ASKER
Also do we need below lines?
rsDetails.CursorType = 0
rsDetails.CursorLocation = 2
rsDetails.LockType = 1
rsDetails.CursorType = 0
rsDetails.CursorLocation = 2
rsDetails.LockType = 1
Yes, you need those lines.
I'll have a look at the other question.
I'll have a look at the other question.
ASKER
thanks
You're welcome.
ASKER
userid-prop.JPG