Solved

Get the contact information using userid

Posted on 2009-03-30
12
216 Views
Last Modified: 2012-05-06
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.
0
Comment
Question by:deshaw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 1

Author Comment

by:deshaw
ID: 24026363
forgotton attachment. Please find it here.
userid-prop.JPG
0
 
LVL 2

Expert Comment

by:Shallwin
ID: 24026392
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 
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24026915
Hi, deshaw.

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

Open in new window

0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 1

Author Comment

by:deshaw
ID: 24027209
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.
0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 24027222
Yes.  Simply put it in a subroutine and change WScript.Echo to MsgBox.  Something like this.  Keep in mind that this is just a demonstration of how to do this.  It does not return all the information you want.  
Sub GetContactInfo()
    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
            MsgBox "Name=" & .Fields("displayName") & " Company=" & .Fields("Company") & " Department=" & .Fields("Department") & " Division=" & .Fields("Division")
        End With
    End If
    rsDetails.Close
    Set rsDetails = Nothing
End Sub

Open in new window

0
 
LVL 1

Author Comment

by:deshaw
ID: 24038112
BluDevilFan, what is the type of " rsDetails" variable. Macro giving a syntax error at rsDetails.Open()

Thanks.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24038201
Sorry, I missed one instance of WScript in the code.  Change line 2 to

     Set rsDetails = CreateObject("ADODB.Recordset")
0
 
LVL 1

Author Comment

by:deshaw
ID: 24038221
Thats cool and also we will need to change   rsDetails.Open() to   rsDetails.Open. :)

BlueDevilFan, Could you please help me on http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_24280082.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.
 
0
 
LVL 1

Author Comment

by:deshaw
ID: 24038237
Also do we need below lines?
    rsDetails.CursorType = 0
    rsDetails.CursorLocation = 2
    rsDetails.LockType = 1
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24044677
Yes, you need those lines.

I'll have a look at the other question.
0
 
LVL 1

Author Closing Comment

by:deshaw
ID: 31564707
thanks
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24047716
You're welcome.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question