Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Setting item.ReadReceiptRequested = False does nothing of use?

107 views
Skip to first unread message

No__1__Here

unread,
Nov 21, 2004, 11:07:04 PM11/21/04
to
I've been pulling my hair out trying to figure out why this doesn't
work. The check for the RRR works... and changing it to False seems
to work. However, the message is still "armed" and marking it as read
or deleting/moving it still triggers a receipt to be sent. I'm
beginning to think there's just no way to remove receipts without
something like OSK or Watch-Your-Back. :(

Anyone have any thoughts? :)

BTW, I'm using Outlook 2000 in corporate mode (Exchange 2000, I think,
but this probably doesn't matter (?)).

Public Sub Remove_RCPT()
Dim objApp As Application
Dim objSelection As Selection
Dim objItem As Object

Set objApp = GetObject(, "Outlook.Application")
Set objSelection = objApp.ActiveExplorer.Selection

If objSelection.Count <> 1 Then
MsgBox "Invalid selection"
Else
For Each objItem In objSelection
If objItem.ReadReceiptRequested Then
MsgBox "Receipt requested"
objItem.ReadReceiptRequested = False
objItem.Save
End If
Next

Set objItem = Nothing
Set objSelection = Nothing
Set objApp = Nothing
End Sub

Michael Bauer

unread,
Nov 22, 2004, 1:48:45 AM11/22/04
to
You code seems to be ok.

(Although the For-Each is unnecessary, because that case is executed if
selection=1 only.)

I haven´t tested but know this behaviour from the Unread property, too.
Setting it to false won´t work in OL2k. So I would suggest trying it via
CDO. The property name is "ReadReceipt".


--
Viele Grüße
Michael Bauer


"No__1__Here" <no__1...@hotmail.com> wrote in message
news:5eace297.04112...@posting.google.com...

No__1__Here

unread,
Nov 22, 2004, 12:08:58 PM11/22/04
to
"Michael Bauer" <mi...@t-online.de> wrote in message news:<uJ3Hd8F0...@TK2MSFTNGP14.phx.gbl>...

> You code seems to be ok.
>
> (Although the For-Each is unnecessary, because that case is executed if
> selection=1 only.)
>
> I haven´t tested but know this behaviour from the Unread property, too.
> Setting it to false won´t work in OL2k. So I would suggest trying it via
> CDO. The property name is "ReadReceipt".
>
>
> --
> Viele Grüße
> Michael Bauer
>
>

The for-each loop is indeed not needed. It was left over from other
"stuff". The case statement has more options in reality, but the
extra code didn't add to what I was hoping to describe. :)

I was pretty much of the opinion that CDO and/or MAPI was my only
hope. Thank you for helping me get going in the right direction. Of
course I don't know CDO at all. :p

Michael Bauer

unread,
Nov 22, 2004, 12:34:09 PM11/22/04
to
You will need a reference on "Microsoft CDO 1.21 Library" (Menu
Extras/References in your VBA-IDE). In OL2k CDO is optional, therefor
you maybe have to install it separatly from your Office-/OL CD.

Then you could use this function to get a reference on a CDO Message for
a given OL MailItem:

Public Function GetMessage(olMail As outlook.MailItem) As MAPI.Message
On Error Resume Next
Dim oMapiSess As MAPI.Session
Dim sEntryID As String
Dim sStoreID As String

sEntryID = olMail.EntryID
sStoreID = olMail.Parent.StoreID
Set oMapiSess = CreateObject("MAPI.Session")
oMapiSess.LogOn , , False, False, , True
Set GetMessage = oMapiSess.GetMessage(sEntryID, sStoreID)
End Function


--
Viele Grüße
Michael Bauer

"No__1__Here" <no__1...@hotmail.com> wrote in message
news:5eace297.04112...@posting.google.com...

No__1__Here

unread,
Nov 22, 2004, 5:39:33 PM11/22/04
to
Michael Bauer wrote:
> You will need a reference on "Microsoft CDO 1.21 Library" (Menu
> Extras/References in your VBA-IDE). In OL2k CDO is optional, therefor
> you maybe have to install it separatly from your Office-/OL CD.
>
> Then you could use this function to get a reference on a CDO Message for
> a given OL MailItem:
>
> Public Function GetMessage(olMail As outlook.MailItem) As MAPI.Message
> On Error Resume Next
> Dim oMapiSess As MAPI.Session
> Dim sEntryID As String
> Dim sStoreID As String
>
> sEntryID = olMail.EntryID
> sStoreID = olMail.Parent.StoreID
> Set oMapiSess = CreateObject("MAPI.Session")
> oMapiSess.LogOn , , False, False, , True
> Set GetMessage = oMapiSess.GetMessage(sEntryID, sStoreID)
> End Function
>
>

I have managed to get a bit closer (I guess). I can set the value to
False (setting both CDO and IMessage below, I'm sure only one is
enough), and after doing this I can use CopyTo to create a copy that
does not have a receipt. Now the problem is how to get rid of the
original without triggering a receipt? If I use CDO's .Delete a receipt
is sent.

Before trying the CopyTo I tried to just set the value to False on the
original email. It doesn't complain, but it also doesn't save the
change. Subsequent iterations still show the value as True.

Many thanks for your patience. :)


Public Sub CDO_RCPT()
Dim ItemId As String
Dim StoreId As String
Dim olSelection As Selection
Dim olItem As Object 'selected item may not be a MailItem
Dim objCopyMessage As Object
Dim objFolder As Object
Dim oSession As MAPI.Session

Set olSelection = ThisOutlookSession.ActiveExplorer.Selection
Set olItem = olSelection.Item(1)
ItemId = olItem.EntryID
StoreId = olItem.Parent.StoreId
Set olItem = Nothing
Set olSelection = Nothing

Set oSession = New MAPI.Session
oSession.Logon , , , False
Set olItem = oSession.GetMessage(ItemId, StoreId)

If olItem.Fields(CdoPR_MESSAGE_CLASS).Value = "IPM.Note" Then
olItem.ReadReceipt = False
olItem.Fields(CdoPR_READ_RECEIPT_REQUESTED).Value = False
'olItem.Fields(CdoPR_MESSAGE_FLAGS).Value = 0

Set objFolder = oSession.Inbox
Set objCopyMessage = olItem.CopyTo(objFolder.ID)
objCopyMessage.Update
Set objCopyMessage = Nothing
Set objFolder = Nothing


' Delete original message -- still triggers receipt
'olItem.Delete
End If

Set olItem = Nothing
oSession.Logoff
Set oSession = Nothing
End Sub

Michael Bauer

unread,
Nov 23, 2004, 12:37:57 AM11/23/04
to
You need to update the original message.

BTW: I would check the olItem.Class as early as possible, before doing
all the stuff with the Mapi.Session.

--
Viele Grüße
Michael Bauer


"No__1__Here" <no__1...@hotmail.com> wrote in message

news:FUtod.23526$fC4....@newssvr11.news.prodigy.com...

No__1__Here

unread,
Nov 29, 2004, 6:05:24 PM11/29/04
to
Michael Bauer wrote:
> You need to update the original message.
>
> BTW: I would check the olItem.Class as early as possible, before doing
> all the stuff with the Mapi.Session.
>

Michael, I appreciate your help. I'm not sure what you mean by "update
the original message". At any rate, I just can't seem to make this
work. All I want to do is strip off the read receipt. Seems it should
be trivial, but I'm obviously missing something. :p Do you (or Sue or
Ken or anyone else) have any thoughts?

Using OL2002 at home I can set it so I'm prompted and can selectively
return receipts. However, at work I'm forced to use OL2K which doesn't
have that option, thus the desire for this to work.


Option Explicit

Sub CDO_RCPT()
Dim ItemId As String
Dim StoreId As String
Dim olSelection As Selection
Dim olItem As Object

Dim objCopyMessage As Object
Dim objFolder As Object
Dim oSession As MAPI.Session

' Use OOM to get the Entry Id


Set olSelection = ThisOutlookSession.ActiveExplorer.Selection
Set olItem = olSelection.Item(1)

Set olSelection = Nothing

' Ensure it is a mail item
If olItem.Class = 43 Then


ItemId = olItem.EntryID
StoreId = olItem.Parent.StoreId
Set olItem = Nothing

' Grab the item via CDO


Set oSession = New MAPI.Session
oSession.Logon , , , False
Set olItem = oSession.GetMessage(ItemId, StoreId)

' Neither of these works as desired
' I saw refs to removing this field in another post
olItem.Fields(CdoPR_MESSAGE_RECIP_ME).Value = False
olItem.Fields(CdoPR_MESSAGE_RECIP_ME).Delete

' This doesn't stick
' Saw a post that says this can't be changed, though...
olItem.Fields(CdoPR_MESSAGE_FLAGS).Value = 0

' These two transfer to the CopyTo below, but remain on the
' original message


olItem.ReadReceipt = False
olItem.Fields(CdoPR_READ_RECEIPT_REQUESTED).Value = False

' Update the message
olItem.Update True, True

' Make a copy, without the receipt


Set objFolder = oSession.Inbox
Set objCopyMessage = olItem.CopyTo(objFolder.ID)
objCopyMessage.Update
Set objCopyMessage = Nothing
Set objFolder = Nothing

' Delete original -- needs to bypass Deleted Items,
' but it does not!
olItem.Delete

' Disconnect from MAPI session


oSession.Logoff
Set oSession = Nothing

Else
MsgBox "Selected item is not a mail item"
End If

Set olItem = Nothing

End Sub

No__1__Here

unread,
Nov 29, 2004, 9:47:17 PM11/29/04
to
Never mind, I guess. The code is in fact working. I guess I have the
"Outlook cache problem". If I close Outlook and restart it the receipt
is in fact gone. Thanks!

Ken Slovak - [MVP - Outlook]

unread,
Nov 30, 2004, 9:15:48 AM11/30/04
to
You can also declare the olItem object as a MAPI.Message and directly access
the DeliveryReceipt and ReadReciept Boolean properties. And to delete an
item without it's going to the Deleted Items folder just use olItem.Delete
(as a MAPI.Message), that will bypass Deleted Items. Always also make sure
to use olItem.Update to save any changes.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"No__1__Here" <no__1...@hotmail.com> wrote in message

news:VaRqd.38969$Al3....@newssvr30.news.prodigy.com...

0 new messages