Michael Nagy
New Member
- Outlook version
- Outlook 2010 32 bit
- Email Account
- Exchange Server 2010
To prevent compliance breeches I'm writing some code to delay sending of emails to external recipients.
A familiar problem but solutions I've seen only address email but no other Outlook types.
Most of my code works OK but I am having trouble removing the delay on a delayed MeetingItem.
Urgent items can be sent immediately by re-sending them again from the Outbox. The code should remove any existing delay, therefore sending immediately.
The following works for MailItems but fails for MeetingItem as meeting updates don't seem to inherit the existing delay.
Dim objNamespace As Outlook.NameSpace
Dim objItem As Object ' can be MailItem, MeetingItem etc
Dim objRecips As Outlook.Recipients
Dim objAttachments As Outlook.Attachments
Dim iCounter As Integer
Dim strMsgExtRecips As String
Dim strMsgAttachments As String
Dim strPrompt As String
Const PR_SMTP_ADDRESS As String = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
Const NoDeferredDelivery As String = "1/01/4501" ' Magic number Outlook uses for "delay mail box isn't checked"
Set objNamespace = Application.GetNamespace("MAPI")
Set objItem = Item 'Set object to the email just sent
' If item is currently delayed, remove the delay and quit.
If objItem.DeferredDeliveryTime <> NoDeferredDelivery Then
strPrompt = "Do you want to send immediately?"
If (MsgBox(strPrompt, vbYesNo + vbInformation + vbMsgBoxSetForeground, "Delivery delay will be removed") = vbYes) Then
objItem.DeferredDeliveryTime = NoDeferredDelivery
GoTo Procedure_Exit
Else
Cancel = True
GoTo Procedure_Exit
End If
End If
Any pointers greatly appreciated.
A familiar problem but solutions I've seen only address email but no other Outlook types.
Most of my code works OK but I am having trouble removing the delay on a delayed MeetingItem.
Urgent items can be sent immediately by re-sending them again from the Outbox. The code should remove any existing delay, therefore sending immediately.
The following works for MailItems but fails for MeetingItem as meeting updates don't seem to inherit the existing delay.
Dim objNamespace As Outlook.NameSpace
Dim objItem As Object ' can be MailItem, MeetingItem etc
Dim objRecips As Outlook.Recipients
Dim objAttachments As Outlook.Attachments
Dim iCounter As Integer
Dim strMsgExtRecips As String
Dim strMsgAttachments As String
Dim strPrompt As String
Const PR_SMTP_ADDRESS As String = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
Const NoDeferredDelivery As String = "1/01/4501" ' Magic number Outlook uses for "delay mail box isn't checked"
Set objNamespace = Application.GetNamespace("MAPI")
Set objItem = Item 'Set object to the email just sent
' If item is currently delayed, remove the delay and quit.
If objItem.DeferredDeliveryTime <> NoDeferredDelivery Then
strPrompt = "Do you want to send immediately?"
If (MsgBox(strPrompt, vbYesNo + vbInformation + vbMsgBoxSetForeground, "Delivery delay will be removed") = vbYes) Then
objItem.DeferredDeliveryTime = NoDeferredDelivery
GoTo Procedure_Exit
Else
Cancel = True
GoTo Procedure_Exit
End If
End If
Any pointers greatly appreciated.