Determine sending account in Outlook COM Add-in

M

Matt Fletcher

Is there any way to determine which Outlook account a message will be sent
from,
either using OOM or Extended MAPI?

I've inherited code which changes the account a mail is sent from (by
changing the MAPI properties of the mail in a handler attached to the
outbox), and I now want to enhance this code to test for the current sending
account in order to decide whether to change the account. However, if I look
at a message in the outbox, none of the properties which my inherited code
sets (e.g. 0x8032) are currently set.

Any clues much appreciated.
Matt Fletcher
 
P

Peter Huang

Hi

If you mean the name in the From mail header, you may take a look at the
SentOnBehalfOfName and SenderName Properties of MailItem Object
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaol10/htm
l/olobjMailItem.asp

If you mean the user account which runs the code to send the mail, we may
try to use the GetUserName API which will return the username under which
the current thread ran.
GetUserName
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/bas
e/getusername.asp

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

Matt Fletcher

Peter,

thanks for the reply, but neither of your suggestions fit with what I am
trying to do..

Let me clarify what I am trying to do:
I have code which catches a message in the Outlook outbox as it is being
sent. This code dynamically re-routes the message by changing certain MAPI
properties, in order to change the Outlook e-mail account that the message
will be sent from. Currently the code just writes these MAPI properties for
all messages that have been flagged - I want to amend the code to only write
these MAPI properties for messages which have been sent using a specific
account. (Note that it is the Outlook account and _not_ the e-mail address
which I am interested in, as I am dealing with multiple e-mail accounts with
the same e-mail address but different SMTP servers).

So my requirement is:
I need to be able to determine which Outlook e-mail account an e-mail
waiting to be sent in the outbox will be sent with. Is this possible using
OOM or Extended MAPI?

Thanks
Matt Fletcher
 
K

Ken Slovak - [MVP - Outlook]

After an item has been sent but before it hits the transport you can check
which account in a profile sent the email, along with the email address as
long as the item is saved. The properties to look at have property tags of
0x0E28001E and 0x0E29001E . The properties are PT_STRING8 and have a format
of:
account number <0x01> email address <0x01> account number

So for example account # 3,[email protected],foobar where the commas would
actually be 0x01 characters.

If you are trapping Item_Send you will have to save the item before you try
to examine those properties. These properties will not be present in Outlook
2000 as far as I can tell, only Outlook 2002 or 2003, so you need to have
that information. Then it's just a decision tree to see if they are there
and if they are to parse the properties to retrieve the sending information.
 
M

Matt Fletcher

Thanks for the answer, Ken.

I've tried dumping all the MAPI properties for a message both in my
Application::ItemSend handler (after saving the MailItem) and in my outbox
handler. Unfortunately I cannot see either of the properties you mention,
either by dumping the properties using my own code (see below for code
sample and dumped properties), or by using Outlook Spy on the message in the
outbox.

When I started working on this fix I expected to see both the properties you
specify (0x0E28001E and 0x0E29001E) and two others that would also be of use
(0x8032001E - account number and e-mail address and 0x8033001E - account
name). These are the four properties that the code I've inherited changes to
divert the mail to a different account.

FYI, I'm using Outlook 2002 SP-2 (10.4219.4219).

Thanks in advance
Matt Fletcher


The output I get from dumping all properties for a mail when it has arrived
in the outbox is as follows:

08:59:35:490 0000053C 03F4 Property: 0002000b = true
08:59:35:490 0000053C 03F4 Property: 00170003 = 0x00000001
08:59:35:490 0000053C 03F4 Property: 001a001e = 'IPM.Note'
08:59:35:490 0000053C 03F4 Property: 0023000b = false
08:59:35:490 0000053C 03F4 Property: 00260003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 0029000b = false
08:59:35:490 0000053C 03F4 Property: 00360003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 0037001e = 'Subject line'
08:59:35:490 0000053C 03F4 Property: 00390040 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0070001e = 'Subject line'
08:59:35:490 0000053C 03F4 Property: 00710102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e01000b = false
08:59:35:490 0000053C 03F4 Property: 0e04001e = 'Matt4
([email protected])'
08:59:35:490 0000053C 03F4 Property: 0e060040 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e070003 = 0x0000000c
08:59:35:490 0000053C 03F4 Property: 0e080003 = 0x000003d7
08:59:35:490 0000053C 03F4 Property: 0e0a0102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e140003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 0e1f000b = true
08:59:35:490 0000053C 03F4 Property: 1000001e = 'Message body
'
08:59:35:490 0000053C 03F4 Property: 10060003 = 0x5972bba0
08:59:35:490 0000053C 03F4 Property: 10070003 = 0x0000000b
08:59:35:490 0000053C 03F4 Property: 1008001e = 'MESSAGEBODY'
08:59:35:490 0000053C 03F4 Property: 10090102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 10100003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 10110003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 10800003 = 0xffffffff
08:59:35:490 0000053C 03F4 Property: 30070040 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 30080040 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 300b0102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 3fde0003 = 0x00004e9f
08:59:35:490 0000053C 03F4 Property: 59090003 = 0x00000001
08:59:35:490 0000053C 03F4 Property: 65400003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 8016000b = false
08:59:35:490 0000053C 03F4 Property: 80180003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 801e0003 = 0x0001971b
08:59:35:490 0000053C 03F4 Property: 802f0003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 80300040 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 8045001e = '10.0'
08:59:35:490 0000053C 03F4 Property: 8046000b = false
08:59:35:490 0000053C 03F4 Property: 804a000b = false
08:59:35:490 0000053C 03F4 Property: 804d0003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 8062000b = false
08:59:35:490 0000053C 03F4 Property: 003d001e = ''
08:59:35:490 0000053C 03F4 Property: 0e02001e = ''
08:59:35:490 0000053C 03F4 Property: 0e03001e = ''
08:59:35:490 0000053C 03F4 Property: 0e090102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e12000d (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e13000d (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e1b000b = false
08:59:35:490 0000053C 03F4 Property: 0e1d001e = 'Subject line'
08:59:35:490 0000053C 03F4 Property: 0ff40003 = 0x00000002
08:59:35:490 0000053C 03F4 Property: 0ff70003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 0ff80102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0ff90102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0ffa0102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0ffb0102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0ffe0003 = 0x00000005
08:59:35:490 0000053C 03F4 Property: 0fff0102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 340d0003 = 0x000237fd
08:59:35:490 0000053C 03F4 Property: 34140102 (value undetermined)

My C++ code (apologies, as I know you're a VB man) for dumping the
properties is as follows:

HRESULT CPropertyDump::Dump(CComPtr<IMAPIProp> spMapiProp, LPCTSTR
szObjectName)
{
LPSPropTagArray pta;
HRESULT hr = spMapiProp->GetPropList(0, &pta);

if (SUCCEEDED(hr))
{
ULONG ulCount = pta->cValues;
LPSPropValue ppv;
hr = spMapiProp->GetProps(pta, 0, &ulCount, &ppv);
if (SUCCEEDED(hr))
{
for (ULONG p = 0; p < ulCount; p++)
{
ULONG ulProperty = ppv[p].ulPropTag;

switch(ulProperty & 0xFFFF)
{
case PT_LONG:
SPTRACE("Property: %08x = 0x%08x\n",
ppv[p].ulPropTag,
ppv[p].Value.l);
break;
case PT_STRING8:
SPTRACE("Property: %08x = '%s'\n",
ppv[p].ulPropTag,
ppv[p].Value.lpszA);
break;
case PT_BOOLEAN:
SPTRACE("Property: %08x = %s\n",
ppv[p].ulPropTag,
(ppv[p].Value.b == 0) ? "false" : "true");
break;
default:
SPTRACE("Property: %08x (value undetermined)\n",
ppv[p].ulPropTag);
break;
}
}
::MAPIFreeBuffer(ppv);
}
MAPIFreeBuffer(pta);
}
return hr;
}
 
K

Ken Slovak - [MVP - Outlook]

I've used code in Item_Send, I haven't tried this using
Application_ItemSend.

There's also another property that gets set when an alternate email account
is used, it's a named property with an ID of 0x8581, also PT_STRING8.

I get that using the following Redemption code from Item_Send. The code is
in VB but it may make sense to you. The AltSenderEmailAddressTag function is
called at startup to get the property tag to use for the named property. It
will have a different tag for any InfoStore, so you need to get it
dynamically and can't hard code a value. The return value from this function
call is stored in a global Long so it can be used with any Send.

Public Function AltSenderEmailAddressTag() As Long
Dim oMail As Outlook.MailItem
Dim i As Long
Dim lngTag As Long

Const SEND_ADDRESS_PROPTAG As String = _
"{00062008-0000-0000-C000-000000000046}"

Const MAPI_ALT_SENDER = &H8581

On Error Resume Next

' gobjInbox is a global for the default Inbox
For i = 1 To gobjInbox.Items.Count
Set oMail = Nothing
Set oMail = gobjInbox.Items(i)
If Err Then
Err.Clear
i = i + 1
Else
Exit For
End If
Next i

' gobjMail is a global for a Redemption.SafeMailItem
If Not (oMail Is Nothing) Then
gobjMail.Item = oMail
lngTag = gobjMail.GetIDsFromNames(SEND_ADDRESS_PROPTAG, _
MAPI_ALT_SENDER) Or &H1E
If Err Then
Err.Clear
lngTag = 0
End If
Else
lngTag = 0
End If

Set oMail = Nothing

AltSenderEmailAddressTag = lngTag
End Function

In Item_Send, which is being handled in an Inspector wrapper class module
where "m_objMail" is the module level MailItem object that is the
Inspector.CurrentItem:

Private Sub m_objMail_Send(Cancel As Boolean)
Dim strAltSender As String
Dim arySender() As String

On Error Resume Next

If Not (m_objMail.Saved) Then
m_objMail.Save
End If

gobjMail.Item = m_objMail 'set Redemption.SafeMailItem
strAltSender = gobjMail.Fields(g_lngAltSenderTag) 'global Long for tag
If strAltSender = "" Then
Err.Clear
'not using alternate email account
Else
arySender = Split(strAltSender, Chr(1))
' arySender(0) now = account #
' arySender(1) now = email account string with trailing Null.
End If

'Now for the other properties
Debug.Print gobjMail.Fields(&HE28001E)
Debug.Print gobjMail.Fields(&HE29001E)
End Sub

One thing you can look at using OutlookSpy is to send an item using an
alternate email account in a profile and then look at the item using
IMessage in Sent Items.




Matt Fletcher said:
Thanks for the answer, Ken.

I've tried dumping all the MAPI properties for a message both in my
Application::ItemSend handler (after saving the MailItem) and in my outbox
handler. Unfortunately I cannot see either of the properties you mention,
either by dumping the properties using my own code (see below for code
sample and dumped properties), or by using Outlook Spy on the message in the
outbox.

When I started working on this fix I expected to see both the properties you
specify (0x0E28001E and 0x0E29001E) and two others that would also be of use
(0x8032001E - account number and e-mail address and 0x8033001E - account
name). These are the four properties that the code I've inherited changes to
divert the mail to a different account.

FYI, I'm using Outlook 2002 SP-2 (10.4219.4219).

Thanks in advance
Matt Fletcher


The output I get from dumping all properties for a mail when it has arrived
in the outbox is as follows:

08:59:35:490 0000053C 03F4 Property: 0002000b = true
08:59:35:490 0000053C 03F4 Property: 00170003 = 0x00000001
08:59:35:490 0000053C 03F4 Property: 001a001e = 'IPM.Note'
08:59:35:490 0000053C 03F4 Property: 0023000b = false
08:59:35:490 0000053C 03F4 Property: 00260003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 0029000b = false
08:59:35:490 0000053C 03F4 Property: 00360003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 0037001e = 'Subject line'
08:59:35:490 0000053C 03F4 Property: 00390040 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0070001e = 'Subject line'
08:59:35:490 0000053C 03F4 Property: 00710102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e01000b = false
08:59:35:490 0000053C 03F4 Property: 0e04001e = 'Matt4
([email protected])'
08:59:35:490 0000053C 03F4 Property: 0e060040 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e070003 = 0x0000000c
08:59:35:490 0000053C 03F4 Property: 0e080003 = 0x000003d7
08:59:35:490 0000053C 03F4 Property: 0e0a0102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e140003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 0e1f000b = true
08:59:35:490 0000053C 03F4 Property: 1000001e = 'Message body
'
08:59:35:490 0000053C 03F4 Property: 10060003 = 0x5972bba0
08:59:35:490 0000053C 03F4 Property: 10070003 = 0x0000000b
08:59:35:490 0000053C 03F4 Property: 1008001e = 'MESSAGEBODY'
08:59:35:490 0000053C 03F4 Property: 10090102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 10100003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 10110003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 10800003 = 0xffffffff
08:59:35:490 0000053C 03F4 Property: 30070040 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 30080040 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 300b0102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 3fde0003 = 0x00004e9f
08:59:35:490 0000053C 03F4 Property: 59090003 = 0x00000001
08:59:35:490 0000053C 03F4 Property: 65400003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 8016000b = false
08:59:35:490 0000053C 03F4 Property: 80180003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 801e0003 = 0x0001971b
08:59:35:490 0000053C 03F4 Property: 802f0003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 80300040 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 8045001e = '10.0'
08:59:35:490 0000053C 03F4 Property: 8046000b = false
08:59:35:490 0000053C 03F4 Property: 804a000b = false
08:59:35:490 0000053C 03F4 Property: 804d0003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 8062000b = false
08:59:35:490 0000053C 03F4 Property: 003d001e = ''
08:59:35:490 0000053C 03F4 Property: 0e02001e = ''
08:59:35:490 0000053C 03F4 Property: 0e03001e = ''
08:59:35:490 0000053C 03F4 Property: 0e090102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e12000d (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e13000d (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e1b000b = false
08:59:35:490 0000053C 03F4 Property: 0e1d001e = 'Subject line'
08:59:35:490 0000053C 03F4 Property: 0ff40003 = 0x00000002
08:59:35:490 0000053C 03F4 Property: 0ff70003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 0ff80102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0ff90102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0ffa0102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0ffb0102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0ffe0003 = 0x00000005
08:59:35:490 0000053C 03F4 Property: 0fff0102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 340d0003 = 0x000237fd
08:59:35:490 0000053C 03F4 Property: 34140102 (value undetermined)

My C++ code (apologies, as I know you're a VB man) for dumping the
properties is as follows:

HRESULT CPropertyDump::Dump(CComPtr<IMAPIProp> spMapiProp, LPCTSTR
szObjectName)
{
LPSPropTagArray pta;
HRESULT hr = spMapiProp->GetPropList(0, &pta);

if (SUCCEEDED(hr))
{
ULONG ulCount = pta->cValues;
LPSPropValue ppv;
hr = spMapiProp->GetProps(pta, 0, &ulCount, &ppv);
if (SUCCEEDED(hr))
{
for (ULONG p = 0; p < ulCount; p++)
{
ULONG ulProperty = ppv[p].ulPropTag;

switch(ulProperty & 0xFFFF)
{
case PT_LONG:
SPTRACE("Property: %08x = 0x%08x\n",
ppv[p].ulPropTag,
ppv[p].Value.l);
break;
case PT_STRING8:
SPTRACE("Property: %08x = '%s'\n",
ppv[p].ulPropTag,
ppv[p].Value.lpszA);
break;
case PT_BOOLEAN:
SPTRACE("Property: %08x = %s\n",
ppv[p].ulPropTag,
(ppv[p].Value.b == 0) ? "false" : "true");
break;
default:
SPTRACE("Property: %08x (value undetermined)\n",
ppv[p].ulPropTag);
break;
}
}
::MAPIFreeBuffer(ppv);
}
MAPIFreeBuffer(pta);
}
return hr;
}
 
M

Matt Fletcher

Ken,

thanks for this - your hint about looking at a sent item has made me realise
what my problem is. I had been assuming that the account properties
(0x0E28001E etc) would be created for all messages, and not just for
messages being sent using an account other than the default account. Now
that I've run my dump code against a message sent from a non-default
account, I can see the account details that I need.

I'll make a mental note to assume less, test more and be slower to post in
future!

Thanks
Matt Fletcher

Ken Slovak - said:
I've used code in Item_Send, I haven't tried this using
Application_ItemSend.

There's also another property that gets set when an alternate email account
is used, it's a named property with an ID of 0x8581, also PT_STRING8.

I get that using the following Redemption code from Item_Send. The code is
in VB but it may make sense to you. The AltSenderEmailAddressTag function is
called at startup to get the property tag to use for the named property. It
will have a different tag for any InfoStore, so you need to get it
dynamically and can't hard code a value. The return value from this function
call is stored in a global Long so it can be used with any Send.

Public Function AltSenderEmailAddressTag() As Long
Dim oMail As Outlook.MailItem
Dim i As Long
Dim lngTag As Long

Const SEND_ADDRESS_PROPTAG As String = _
"{00062008-0000-0000-C000-000000000046}"

Const MAPI_ALT_SENDER = &H8581

On Error Resume Next

' gobjInbox is a global for the default Inbox
For i = 1 To gobjInbox.Items.Count
Set oMail = Nothing
Set oMail = gobjInbox.Items(i)
If Err Then
Err.Clear
i = i + 1
Else
Exit For
End If
Next i

' gobjMail is a global for a Redemption.SafeMailItem
If Not (oMail Is Nothing) Then
gobjMail.Item = oMail
lngTag = gobjMail.GetIDsFromNames(SEND_ADDRESS_PROPTAG, _
MAPI_ALT_SENDER) Or &H1E
If Err Then
Err.Clear
lngTag = 0
End If
Else
lngTag = 0
End If

Set oMail = Nothing

AltSenderEmailAddressTag = lngTag
End Function

In Item_Send, which is being handled in an Inspector wrapper class module
where "m_objMail" is the module level MailItem object that is the
Inspector.CurrentItem:

Private Sub m_objMail_Send(Cancel As Boolean)
Dim strAltSender As String
Dim arySender() As String

On Error Resume Next

If Not (m_objMail.Saved) Then
m_objMail.Save
End If

gobjMail.Item = m_objMail 'set Redemption.SafeMailItem
strAltSender = gobjMail.Fields(g_lngAltSenderTag) 'global Long for tag
If strAltSender = "" Then
Err.Clear
'not using alternate email account
Else
arySender = Split(strAltSender, Chr(1))
' arySender(0) now = account #
' arySender(1) now = email account string with trailing Null.
End If

'Now for the other properties
Debug.Print gobjMail.Fields(&HE28001E)
Debug.Print gobjMail.Fields(&HE29001E)
End Sub

One thing you can look at using OutlookSpy is to send an item using an
alternate email account in a profile and then look at the item using
IMessage in Sent Items.




Matt Fletcher said:
Thanks for the answer, Ken.

I've tried dumping all the MAPI properties for a message both in my
Application::ItemSend handler (after saving the MailItem) and in my outbox
handler. Unfortunately I cannot see either of the properties you mention,
either by dumping the properties using my own code (see below for code
sample and dumped properties), or by using Outlook Spy on the message in the
outbox.

When I started working on this fix I expected to see both the properties you
specify (0x0E28001E and 0x0E29001E) and two others that would also be of use
(0x8032001E - account number and e-mail address and 0x8033001E - account
name). These are the four properties that the code I've inherited
changes
to
divert the mail to a different account.

FYI, I'm using Outlook 2002 SP-2 (10.4219.4219).

Thanks in advance
Matt Fletcher


The output I get from dumping all properties for a mail when it has arrived
in the outbox is as follows:

08:59:35:490 0000053C 03F4 Property: 0002000b = true
08:59:35:490 0000053C 03F4 Property: 00170003 = 0x00000001
08:59:35:490 0000053C 03F4 Property: 001a001e = 'IPM.Note'
08:59:35:490 0000053C 03F4 Property: 0023000b = false
08:59:35:490 0000053C 03F4 Property: 00260003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 0029000b = false
08:59:35:490 0000053C 03F4 Property: 00360003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 0037001e = 'Subject line'
08:59:35:490 0000053C 03F4 Property: 00390040 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0070001e = 'Subject line'
08:59:35:490 0000053C 03F4 Property: 00710102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e01000b = false
08:59:35:490 0000053C 03F4 Property: 0e04001e = 'Matt4
([email protected])'
08:59:35:490 0000053C 03F4 Property: 0e060040 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e070003 = 0x0000000c
08:59:35:490 0000053C 03F4 Property: 0e080003 = 0x000003d7
08:59:35:490 0000053C 03F4 Property: 0e0a0102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e140003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 0e1f000b = true
08:59:35:490 0000053C 03F4 Property: 1000001e = 'Message body
'
08:59:35:490 0000053C 03F4 Property: 10060003 = 0x5972bba0
08:59:35:490 0000053C 03F4 Property: 10070003 = 0x0000000b
08:59:35:490 0000053C 03F4 Property: 1008001e = 'MESSAGEBODY'
08:59:35:490 0000053C 03F4 Property: 10090102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 10100003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 10110003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 10800003 = 0xffffffff
08:59:35:490 0000053C 03F4 Property: 30070040 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 30080040 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 300b0102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 3fde0003 = 0x00004e9f
08:59:35:490 0000053C 03F4 Property: 59090003 = 0x00000001
08:59:35:490 0000053C 03F4 Property: 65400003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 8016000b = false
08:59:35:490 0000053C 03F4 Property: 80180003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 801e0003 = 0x0001971b
08:59:35:490 0000053C 03F4 Property: 802f0003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 80300040 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 8045001e = '10.0'
08:59:35:490 0000053C 03F4 Property: 8046000b = false
08:59:35:490 0000053C 03F4 Property: 804a000b = false
08:59:35:490 0000053C 03F4 Property: 804d0003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 8062000b = false
08:59:35:490 0000053C 03F4 Property: 003d001e = ''
08:59:35:490 0000053C 03F4 Property: 0e02001e = ''
08:59:35:490 0000053C 03F4 Property: 0e03001e = ''
08:59:35:490 0000053C 03F4 Property: 0e090102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e12000d (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e13000d (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0e1b000b = false
08:59:35:490 0000053C 03F4 Property: 0e1d001e = 'Subject line'
08:59:35:490 0000053C 03F4 Property: 0ff40003 = 0x00000002
08:59:35:490 0000053C 03F4 Property: 0ff70003 = 0x00000000
08:59:35:490 0000053C 03F4 Property: 0ff80102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0ff90102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0ffa0102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0ffb0102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 0ffe0003 = 0x00000005
08:59:35:490 0000053C 03F4 Property: 0fff0102 (value undetermined)
08:59:35:490 0000053C 03F4 Property: 340d0003 = 0x000237fd
08:59:35:490 0000053C 03F4 Property: 34140102 (value undetermined)

My C++ code (apologies, as I know you're a VB man) for dumping the
properties is as follows:

HRESULT CPropertyDump::Dump(CComPtr<IMAPIProp> spMapiProp, LPCTSTR
szObjectName)
{
LPSPropTagArray pta;
HRESULT hr = spMapiProp->GetPropList(0, &pta);

if (SUCCEEDED(hr))
{
ULONG ulCount = pta->cValues;
LPSPropValue ppv;
hr = spMapiProp->GetProps(pta, 0, &ulCount, &ppv);
if (SUCCEEDED(hr))
{
for (ULONG p = 0; p < ulCount; p++)
{
ULONG ulProperty = ppv[p].ulPropTag;

switch(ulProperty & 0xFFFF)
{
case PT_LONG:
SPTRACE("Property: %08x = 0x%08x\n",
ppv[p].ulPropTag,
ppv[p].Value.l);
break;
case PT_STRING8:
SPTRACE("Property: %08x = '%s'\n",
ppv[p].ulPropTag,
ppv[p].Value.lpszA);
break;
case PT_BOOLEAN:
SPTRACE("Property: %08x = %s\n",
ppv[p].ulPropTag,
(ppv[p].Value.b == 0) ? "false" : "true");
break;
default:
SPTRACE("Property: %08x (value undetermined)\n",
ppv[p].ulPropTag);
break;
}
}
::MAPIFreeBuffer(ppv);
}
MAPIFreeBuffer(pta);
}
return hr;
}
 
K

Ken Slovak - [MVP - Outlook]

Again, assume less :)

In Outlook 2002 and 2003 the 0x0E28 and 0x0E29 properties are there even if
the email is sent using the default email account for that profile. This is
with both PST profiles and Exchange profiles. The 0x8581 property is only
there if a non-default email account is used.

In Outlook 2000 you don't have a send using in C/W mode but you do in
Internet only mode. Outlook 2000 C/W doesn't add any of those 3 properties.
I don't run Internet only mode here any more so I can't tell if any or all
are created when you use a send using in that mode.

So you need to check on startup for Outlook version and if Outlook 2000 for
mode. I do that anyway in my code for lots of other reasons, like seeing
what's supported or if a complete MAPI is there (which it isn't in Internet
only mode). Then once you know that information and combine it with the
existence (or lack thereof) of 0x8581 you can tell if an alternate account
was used. 0x0E28 and 0x0E29 can also be used, since they provide not only
the sending account but also the email address (in EX DN form for Exchange
senders) and also the name of that email account (such as Hotmail or
whatever). Then a decision tree can be used to decide what you are going to
do.
 
P

Peter Huang

Hi

If you still have any concern on this issue please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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