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
(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...
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
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...
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
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...
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
--
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...