Outlook add headers and tags for project IDs
Sub AddHeader(m As Outlook.MailItem,
strProjectNumber As String)
'Dim m As Outlook.MailItem
Dim pa As Outlook.PropertyAccessor
Dim myOlFormat As Integer
myOlFormat =
m.BodyFormat
m.BodyFormat =
olFormatUnspecified
'Set m = Application.CreateItem(olMailItem)
'm.Body = m.Subject
Set pa =
m.PropertyAccessor
pa.SetProperty "http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/X-MS-Exchange-Organization-AECOM-Project", strProjectNumber
Select Case myOlFormat
Case olFormatHTML
m.HTMLBody =
m.HTMLBody & vbCr & "[X-MS-Exchange-Organization-AECOM-Project:" & strProjectNumber & "] "
m.HTMLBody =
m.HTMLBody & vbCr & "
"
[X-MS-Exchange-Organization-AECOM-Project:"
& strProjectNumber & "]
Case olFormatPlain,
olFormatRichText, olFormatUnspecified
m.Body = m.Body
& vbCr & "[X-MS-Exchange-Organization-AECOM-Project:" & strProjectNumber & "]"
End Select
End Sub
Comments
Post a Comment