P
prideoflions
Hello,
Background: This is a followup question to Selective Read Receipts VBA using
run script rule. I wish to set my tracking option to always allow read
receipts, but on every incoming message from someone not in my address book
(set using filters) a script runs allowing me to chose whether to allow the
receipt or not.
Problem: I think there is something wrong in the approach I'm taking to
remove the read receipt from selective addresses. The following code runs and
I've stepped through it using break points and the display comes up, it moves
into the vbno section with a No selection and it steps through the
read.receipt = false portion, but the read receipt goes out as a positive
when read anyway. For some reason the read receipt property either doesn't
change, doesn't stay changed or something.
Thanks!
My 'working' code is as follows:
Sub Test(MyMail As Outlook.MailItem)
Dim strID As String
Dim Display As String
Dim Title As String
Dim olNS As Outlook.NameSpace
Dim Item As Outlook.MailItem
Dim Response As VbMsgBoxResult
Dim Style As VbMsgBoxStyle
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set Item = olNS.GetItemFromID(strID)
Display = "Do you wish to allow a read receipt from " &
Item.SenderEmailAddress & "?"
Style = vbYesNo
Title = "Read Receipt Prompt" ' Define title.
If Item.ReadReceiptRequested = True Then
Response = MsgBox(Display, Style, Title)
If Response = vbNo Then
Item.ReadReceiptRequested = False
Item.Save
End If
End If
Set Item = Nothing
Set olNS = Nothing
End Sub
Background: This is a followup question to Selective Read Receipts VBA using
run script rule. I wish to set my tracking option to always allow read
receipts, but on every incoming message from someone not in my address book
(set using filters) a script runs allowing me to chose whether to allow the
receipt or not.
Problem: I think there is something wrong in the approach I'm taking to
remove the read receipt from selective addresses. The following code runs and
I've stepped through it using break points and the display comes up, it moves
into the vbno section with a No selection and it steps through the
read.receipt = false portion, but the read receipt goes out as a positive
when read anyway. For some reason the read receipt property either doesn't
change, doesn't stay changed or something.
Thanks!
My 'working' code is as follows:
Sub Test(MyMail As Outlook.MailItem)
Dim strID As String
Dim Display As String
Dim Title As String
Dim olNS As Outlook.NameSpace
Dim Item As Outlook.MailItem
Dim Response As VbMsgBoxResult
Dim Style As VbMsgBoxStyle
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set Item = olNS.GetItemFromID(strID)
Display = "Do you wish to allow a read receipt from " &
Item.SenderEmailAddress & "?"
Style = vbYesNo
Title = "Read Receipt Prompt" ' Define title.
If Item.ReadReceiptRequested = True Then
Response = MsgBox(Display, Style, Title)
If Response = vbNo Then
Item.ReadReceiptRequested = False
Item.Save
End If
End If
Set Item = Nothing
Set olNS = Nothing
End Sub