Sendor information

  • Thread starter Thread starter JT
  • Start date Start date
J

JT

When I open an e-mail sent to me by someone within the
company, I can right click on the sender's name. A menu
is displayed and one of the items is "Office: 1234".

1234 is a code for the sender's home office.

Is there a way for me to programmatically (1) open the e-
mail, (2) right click on the sender's name, and (3)
retrieve the home office code?

I can select specific e-mails so that is not an issue but
retrieving the home office codes has been difficult.

I don't need to open the e-mail but will do so if
necessary to retireve the home office code.

I'm stuck on the right click and retrieving the home
office code.

Any help in would be greatly appreciated. Thanks
 
You are talking about the information exposed by the "Person Names" feature
(aka Messenger Presence), correct? The Office information in the third line
is actually coming from the person's entry in your Exchange Global Address
List. However, you cannot use the Outlook Object Model to get this info -
you need to use CDO. Below is an example of how to do it.

First, declare this in the header of yourmodule:
Public Const CdoPR_OFFICE_LOCATION = &H3A19001E

Sub GetGALInfoOfMesssageSender()
On Error Resume Next

Dim objSession As New MAPI.Session
Dim objFolder As Outlook.MAPIFolder
Dim objItem As Object
Dim objMessage As MAPI.Message
Dim objFields As MAPI.Fields, objField As MAPI.Field
Dim objAddE As MAPI.AddressEntry

If ActiveInspector Is Nothing Then Exit Sub

objSession.Logon , , , False
Set objItem = ActiveInspector.CurrentItem
Set objMessage = objSession.GetMessage(objItem.EntryID,
objItem.Parent.StoreID)
Set objAddE = objMessage.Sender 'Security prompt; use Redemption
(http://www.dimastr.com) to bypass
Set objFields = objAddE.Fields

'Get a GAL related field
Set objField = objFields.Item(CdoPR_OFFICE_LOCATION)
If Not objField Is Nothing Then
'This property exists and has a value
Debug.Print objField.Value
End If

objSession.Logoff
Set objItem = Nothing
Set objMessage = Nothing
Set objAddE = Nothing
Set objField = Nothing
Set objFields = Nothing
Set objSession = Nothing
End Sub

Here's a full list of all CDO property tags:

http://msdn.microsoft.com/library/d...en-us/cdo/html/_olemsg_mapi_property_tags.asp

For further info, see:

Using Collaboration Data Objects (CDO) in Microsoft Outlook and Microsoft
Exchange Programming:
http://www.outlookcode.com/d/cdo.htm
 
Eric......Thanks.......I'll give this a try.
-----Original Message-----
You are talking about the information exposed by the "Person Names" feature
(aka Messenger Presence), correct? The Office information in the third line
is actually coming from the person's entry in your Exchange Global Address
List. However, you cannot use the Outlook Object Model to get this info -
you need to use CDO. Below is an example of how to do it.

First, declare this in the header of yourmodule:
Public Const CdoPR_OFFICE_LOCATION = &H3A19001E

Sub GetGALInfoOfMesssageSender()
On Error Resume Next

Dim objSession As New MAPI.Session
Dim objFolder As Outlook.MAPIFolder
Dim objItem As Object
Dim objMessage As MAPI.Message
Dim objFields As MAPI.Fields, objField As MAPI.Field
Dim objAddE As MAPI.AddressEntry

If ActiveInspector Is Nothing Then Exit Sub

objSession.Logon , , , False
Set objItem = ActiveInspector.CurrentItem
Set objMessage = objSession.GetMessage (objItem.EntryID,
objItem.Parent.StoreID)
Set objAddE = objMessage.Sender 'Security prompt; use Redemption
(http://www.dimastr.com) to bypass
Set objFields = objAddE.Fields

'Get a GAL related field
Set objField = objFields.Item(CdoPR_OFFICE_LOCATION)
If Not objField Is Nothing Then
'This property exists and has a value
Debug.Print objField.Value
End If

objSession.Logoff
Set objItem = Nothing
Set objMessage = Nothing
Set objAddE = Nothing
Set objField = Nothing
Set objFields = Nothing
Set objSession = Nothing
End Sub

Here's a full list of all CDO property tags:

http://msdn.microsoft.com/library/default.asp? url=/library/en-us/cdo/html/_olemsg_mapi_property_tags.asp

For further info, see:

Using Collaboration Data Objects (CDO) in Microsoft Outlook and Microsoft
Exchange Programming:
http://www.outlookcode.com/d/cdo.htm

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/



.
 
Back
Top