? for Sue Mosher

G

Guest

Sue..........I have one of your books and found the following code:

Function GetMailBoxUserName()

Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objInbox As Outlook.MAPIFolder
Dim strName As String
Dim intPos As Integer
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
strName = objInbox.Parent.Name
intPos = InStr(1, strName, "Mailbox - ", vbTextCompare)
If intPos > 0 Then
GetMailBoxUserName = Right(strName, intPos + 9)
End If

Set objInbox = Nothing
Set objNS = Nothing
Set objApp = Nothing

End Function

This gets me close to what I'm trying to do but not exactly. In our system,
the address list for e-mails contains the employee's job title. What I would
like to do is get the employee's job title instead of their mailbox name.

Is it possible to modify the above code to get the employee's job title
instead of the mailbox name? Or can I use the mailbox name to find the job
title. I apologize for all of the questions but I'm new to programming in
Outlook and have seen that you have helped a lot of people. The book and
your web site have been terrific resources. Thanks for all of the help.
 
D

David C. Holley

Before you go that far, is Exchange the system of record? If it isn't
the SOR, you may find that the job titles aren't updated in a timely manner.
 
G

Guest

The address list contains other information besides job titles and our
company updates this info on a frequent basis. For what I need the macro to
do, job titles is where I need to go. Thanks for the help........
 
S

Sue Mosher [MVP-Outlook]

The code sample at http://www.outlookcode.com/codedetail.aspx?id=594 shows how to get such details from a GAL recipient. If the MAPI property tag for Job Title isn't among those listed at http://www.cdolive.com/cdo10.htm, you should be able to determine it with a peek from Outlook Spy or MFCMAPI.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top