Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get ‘Manager’ from Outlook Contact Properties Organization tab

Status
Not open for further replies.

jw45

Programmer
May 27, 2005
56
US
I have linked the “Global Address List” from the Exchange server, however, it seems to only contain the information on the ‘General’ tab. Like First, Last, Address, City, State, etc.

When I open the properties of a contact I see a tab label “Organization.” On this tab it lists a manager and direct reports for the contact. Can I access this information via Access? What about from other tabs?


Thanks,
JW

Eat healthy, exercise, get plenty of rest, and you'll still die.
 
jw45,
This might work for you. It sounds like your environment is Microsoft Exchange and Active Directory so you should be able to retrieve this information by using an Active Directory object. The sample will require a reference to Active DS Type Library (activeds.tlb) in your VBA project before it will work.
Code:
Public Function ADsManagerName() As String
'This function requires a reference to _
Active DS Type Library (activeds.tlb)
'Will work in any office application that will _
allow you to write and run a macro
Dim objIADsUser As ActiveDs.IADsUser
Dim strUserID As String, strComputerName As String
strComputerName = Environ$("COMPUTERNAME")
strUserID = Environ$("USERNAME")
Set objIADsUser = GetObject("WinNT://" & _
  strComputerName & "/" & strUserID & ",user")
ADsManagerName = objIADsUser.Manager
Set objIADsUser = Nothing
End Function

Once you have added the reference take a look at the Object Browser to see what other information is available for the users.

Hope this helps,
CMP

(GMT-07:00) Mountain Time (US & Canada)
 
Thanks CMP.

I get the error:

Run-time error '-2147022675(800708ad)':
Automation Error
The user name could not be found.
 
jw45,
Let me guess, Access 2003?

Try substituting your computer name and LAN id instead of using the [tt]ENVIRON$()[/tt] function and see if you get the same result.

CMP

(GMT-07:00) Mountain Time (US & Canada)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top