|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Setting item.ReadReceiptRequested = False does nothing of use?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 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". -- Show quoteHide quoteViele Grüße Michael Bauer "No__1__Here" <no__1__h***@hotmail.com> wrote in message news:5eace297.0411212007.1660db5d@posting.google.com... > 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
Show quote
Hide quote
"Michael Bauer" <mi***@t-online.de> wrote in message news:<uJ3Hd8F0EHA.2192@TK2MSFTNGP14.phx.gbl>... The for-each loop is indeed not needed. It was left over from other> 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 > > "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 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 -- Show quoteHide quoteViele Grüße Michael Bauer "No__1__Here" <no__1__h***@hotmail.com> wrote in message news:5eace297.0411220908.26c9b101@posting.google.com... > "Michael Bauer" <mi***@t-online.de> wrote in message news:<uJ3Hd8F0EHA.2192@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 wrote:
Show quoteHide quote > You will need a reference on "Microsoft CDO 1.21 Library" (Menu I have managed to get a bit closer (I guess). I can set the value to > 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 > > 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 wrote:
Show quoteHide quote > You will need a reference on "Microsoft CDO 1.21 Library" (Menu I have managed to get a bit closer (I guess). I can set the value to > 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 > > 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 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. -- Show quoteHide quoteViele Grüße Michael Bauer "No__1__Here" <no__1__h***@hotmail.com> wrote in message news:FUtod.23526$fC4.1270@newssvr11.news.prodigy.com... > 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 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. -- Show quoteHide quoteViele Grüße Michael Bauer "No__1__Here" <no__1__h***@hotmail.com> wrote in message news:FUtod.23526$fC4.1270@newssvr11.news.prodigy.com... > 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 wrote:
> You need to update the original message. Michael, I appreciate your help. I'm not sure what you mean by "update > > BTW: I would check the olItem.Class as early as possible, before doing > all the stuff with the Mapi.Session. > 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 Michael Bauer wrote:
> You need to update the original message. Michael, I appreciate your help. I'm not sure what you mean by "update > > BTW: I would check the olItem.Class as early as possible, before doing > all the stuff with the Mapi.Session. > 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 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! 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! 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. -- Show quoteHide quoteKen 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__h***@hotmail.com> wrote in message news:VaRqd.38969$Al3.27616@newssvr30.news.prodigy.com... > 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! 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. -- Show quoteHide quoteKen 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__h***@hotmail.com> wrote in message news:VaRqd.38969$Al3.27616@newssvr30.news.prodigy.com... > 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! |
|||||||||||||||||||||||