How to set Outlook Importance property and Follow Up Reminder from VB .NET using CDO

  • Thread starter Thread starter Mikey
  • Start date Start date
M

Mikey

This sample code demonstrates how to send an email message using CDO and
have it set the Outlook Importance property and the Outlook Follow Up
reminder attributes in the recipient's InBox.

The "Follow Up" reminder flag is set to one hour ago which causes the
received message's From, Subject and Date to immediately display in red
color in the recipient's Outlook InBox.


'Add references to:
'--Microsoft Active Data Objects (ADO)
'--Microsoft CDO for Exchange 2000
Dim oMsg As CDO.Message
Dim oFields As ADODB.Fields
Dim oField As ADODB.Field
Try
'Get reference to CDO message object
oMsg = New CDO.Message
oMsg.To = "(e-mail address removed)"
oMsg.From = "(e-mail address removed)"
'
'The Message object's default item property is read-only, however,
'the ADODB Field object it returns to
'has read/write access to the specific property
'you requested
'
'Get a reference to the "importance" property
oField = oMsg.Fields.Item("urn:schemas:mailheader:importance")
'Assign the property a "high" value
oField.Value = "high"
'
'This property specifies what type of Follow Up flag
oMsg.Fields.Append("urn:schemas:mailheader:x-message-flag", _
ADODB.DataTypeEnum.adVarChar, -1, _
ADODB.FieldAttributeEnum.adFldFixed, "Follow Up")
'
'When to Follow Up
' This sets the follow up time to one hour ago.
' This causes the message line in the Outlook InBox to be set to red
color
' as soon as the message is received.
oMsg.Fields.Append("urn:schemas:httpmail:reply-by", _
ADODB.DataTypeEnum.adVarChar, -1, _
ADODB.FieldAttributeEnum.adFldFixed, DateAdd("s", -3600, Now))
'
'Update the fields
oMsg.Fields.Update()
'
'Send the message
oMsg.Send()
Catch ex As Exception
Throw ex
Finally
oMsg = Nothing
End Try

//End of Message//
 
Back
Top