![]() |
|
Assign To and CC list while using Redemption.dll library
Hi,
I could see that objSafeMailItem.To and objSafeMailItem.CC properties are read only. Could any one tell me if there is any way to set added or is being added recipients to To or CC list in below code: ' itm is selected Mail item object Set objSafeMailItem = CreateObject("Redemption.SafeMailItem") Set rpl = CreateObject("Redemption.SafeMailItem") objSafeMailItem.Item = itm rpl.Item = itm.Forward ' By default all recipients are getting added to To list. I want some in CC list as well. Is it possible? rpl.Recipients.Add (objSafeMailItem.Sender.Name) For Each olkRecipient In objSafeMailItem.Recipients rpl.Recipients.Add (olkRecipient.Name) Next rpl.Recipients.ResolveAll Thanks, Paresh |
Assign To and CC list while using Redemption.dll library
It's the same process as when you add a Recipient using the Outlook object
model. Once you get back the SafeRecipient object from the call to SafeRecipients.Add() you set the Type of the Recipient. You use one of the OlMailRecipientType enum members: olTo, olCC or olBCC. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "paresh" wrote in message ... Hi, I could see that objSafeMailItem.To and objSafeMailItem.CC properties are read only. Could any one tell me if there is any way to set added or is being added recipients to To or CC list in below code: ' itm is selected Mail item object Set objSafeMailItem = CreateObject("Redemption.SafeMailItem") Set rpl = CreateObject("Redemption.SafeMailItem") objSafeMailItem.Item = itm rpl.Item = itm.Forward ' By default all recipients are getting added to To list. I want some in CC list as well. Is it possible? rpl.Recipients.Add (objSafeMailItem.Sender.Name) For Each olkRecipient In objSafeMailItem.Recipients rpl.Recipients.Add (olkRecipient.Name) Next rpl.Recipients.ResolveAll Thanks, Paresh |
Assign To and CC list while using Redemption.dll library
Since only reading of the To property is blocked, SafeMailItem only
implements the read access. Since write access is not blocked, you can use the original Outlook Object (itm) Or you can declare objSafeMailItem as a generic Object rather than Redemption.safeMailItem to force late binding: you won't get the compiler warning and Redemption will be happy to forward the calls to the properties and methods that it does not implement to the original object assigned to the Item property. -- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "paresh" wrote in message ... Hi, I could see that objSafeMailItem.To and objSafeMailItem.CC properties are read only. Could any one tell me if there is any way to set added or is being added recipients to To or CC list in below code: ' itm is selected Mail item object Set objSafeMailItem = CreateObject("Redemption.SafeMailItem") Set rpl = CreateObject("Redemption.SafeMailItem") objSafeMailItem.Item = itm rpl.Item = itm.Forward ' By default all recipients are getting added to To list. I want some in CC list as well. Is it possible? rpl.Recipients.Add (objSafeMailItem.Sender.Name) For Each olkRecipient In objSafeMailItem.Recipients rpl.Recipients.Add (olkRecipient.Name) Next rpl.Recipients.ResolveAll Thanks, Paresh |
Assign To and CC list while using Redemption.dll library
Dmitry,
I have changed the type of rpl to Object and below did trick. thanks. rpl.To = objSafeMailItem.To rpl.CC = objSafeMailItem.CC rpl.Recipients.ResolveAll But it is not resolving the recipients now. :-( Any idea? Thanks, Paresh "Dmitry Streblechenko" wrote: Since only reading of the To property is blocked, SafeMailItem only implements the read access. Since write access is not blocked, you can use the original Outlook Object (itm) Or you can declare objSafeMailItem as a generic Object rather than Redemption.safeMailItem to force late binding: you won't get the compiler warning and Redemption will be happy to forward the calls to the properties and methods that it does not implement to the original object assigned to the Item property. -- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "paresh" wrote in message ... Hi, I could see that objSafeMailItem.To and objSafeMailItem.CC properties are read only. Could any one tell me if there is any way to set added or is being added recipients to To or CC list in below code: ' itm is selected Mail item object Set objSafeMailItem = CreateObject("Redemption.SafeMailItem") Set rpl = CreateObject("Redemption.SafeMailItem") objSafeMailItem.Item = itm rpl.Item = itm.Forward ' By default all recipients are getting added to To list. I want some in CC list as well. Is it possible? rpl.Recipients.Add (objSafeMailItem.Sender.Name) For Each olkRecipient In objSafeMailItem.Recipients rpl.Recipients.Add (olkRecipient.Name) Next rpl.Recipients.ResolveAll Thanks, Paresh |
Assign To and CC list while using Redemption.dll library
Ken, this looks great idea. Could you tell me how could I enum rpl.Recipients
and can set the type? rpl.Recipients.Add (objSafeMailItem.Sender.Name) For Each olkRecipient In objSafeMailItem.Recipients rpl.Recipients.Add (olkRecipient.Name) Next ??? Enume rpl.Recipients For Each olkRecipient In rpl.Recipients ?? how to set the type Next thanks, Paresh "Ken Slovak - [MVP - Outlook]" wrote: It's the same process as when you add a Recipient using the Outlook object model. Once you get back the SafeRecipient object from the call to SafeRecipients.Add() you set the Type of the Recipient. You use one of the OlMailRecipientType enum members: olTo, olCC or olBCC. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "paresh" wrote in message ... Hi, I could see that objSafeMailItem.To and objSafeMailItem.CC properties are read only. Could any one tell me if there is any way to set added or is being added recipients to To or CC list in below code: ' itm is selected Mail item object Set objSafeMailItem = CreateObject("Redemption.SafeMailItem") Set rpl = CreateObject("Redemption.SafeMailItem") objSafeMailItem.Item = itm rpl.Item = itm.Forward ' By default all recipients are getting added to To list. I want some in CC list as well. Is it possible? rpl.Recipients.Add (objSafeMailItem.Sender.Name) For Each olkRecipient In objSafeMailItem.Recipients rpl.Recipients.Add (olkRecipient.Name) Next rpl.Recipients.ResolveAll Thanks, Paresh |
Assign To and CC list while using Redemption.dll library
You can use the For...Each loop you show below or you can get the Count of
the original item's Recipients collection and use a standard For...Next loop. It's like iterating any collection, not rocket science. To assign the type is totally simple: oRecip.Type = OlMailRecipientType.olTo ' or olCC or olBCC -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "paresh" wrote in message ... Ken, this looks great idea. Could you tell me how could I enum rpl.Recipients and can set the type? rpl.Recipients.Add (objSafeMailItem.Sender.Name) For Each olkRecipient In objSafeMailItem.Recipients rpl.Recipients.Add (olkRecipient.Name) Next ??? Enume rpl.Recipients For Each olkRecipient In rpl.Recipients ?? how to set the type Next thanks, Paresh |
Assign To and CC list while using Redemption.dll library
Thanks Ken, I did below:
For Each olkRecipient In objSafeMailItem.Recipients olkRecipient.Type = OlMailRecipientType.olCC rpl.Recipients.Add (olkRecipient.Name) Next Still it is adding it To list only all the recipients. Am I doing anything wrong? Thanks, Paresh "Ken Slovak - [MVP - Outlook]" wrote: You can use the For...Each loop you show below or you can get the Count of the original item's Recipients collection and use a standard For...Next loop. It's like iterating any collection, not rocket science. To assign the type is totally simple: oRecip.Type = OlMailRecipientType.olTo ' or olCC or olBCC -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "paresh" wrote in message ... Ken, this looks great idea. Could you tell me how could I enum rpl.Recipients and can set the type? rpl.Recipients.Add (objSafeMailItem.Sender.Name) For Each olkRecipient In objSafeMailItem.Recipients rpl.Recipients.Add (olkRecipient.Name) Next ??? Enume rpl.Recipients For Each olkRecipient In rpl.Recipients ?? how to set the type Next thanks, Paresh |
Assign To and CC list while using Redemption.dll library
You are attempting to change the Type of the original recipients and hoping
they will be that Type when added to a new mail item as recipients, and it just doesn't work that way. Any recipient object added to a mail item will be olTo unless you explicitly set its Type on the new Recipient object. For Each olkRecipient In objSafeMailItem.Recipients Set oRecip = rpl.Recipients.Add (olkRecipient.Name) oRecip.Type = OlMailRecipientType.olCC Next You of course would have to declare that oRecip object somewhere prior to that loop. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "paresh" wrote in message ... Thanks Ken, I did below: For Each olkRecipient In objSafeMailItem.Recipients olkRecipient.Type = OlMailRecipientType.olCC rpl.Recipients.Add (olkRecipient.Name) Next Still it is adding it To list only all the recipients. Am I doing anything wrong? Thanks, Paresh |
Assign To and CC list while using Redemption.dll library
Thanks Ken, it works absolutely fine. See my below code:
rpl.Recipients.Add (objSafeMailItem.Sender.Name) For Each olkRecipient In objSafeMailItem.Recipients Set odRecip = olkRecipient Set oRecip = rpl.Recipients.Add(olkRecipient.Name) oRecip.Type = odRecip.Type Next rpl.Recipients.ResolveAll I have only one problem in resolving the email addresses that are outside our domain. It resolves the our domain address perfectly but it can't if email address in outside the domain. I think this is happening because I am using Recipient.Name property. So suppose name="xxx yyy" and oririginal email id = " then it keeps "xxx yyy" in the recipients list and not resoving to original email id. Could you help me here. Thanks for being there. Paresh "Ken Slovak - [MVP - Outlook]" wrote: You are attempting to change the Type of the original recipients and hoping they will be that Type when added to a new mail item as recipients, and it just doesn't work that way. Any recipient object added to a mail item will be olTo unless you explicitly set its Type on the new Recipient object. For Each olkRecipient In objSafeMailItem.Recipients Set oRecip = rpl.Recipients.Add (olkRecipient.Name) oRecip.Type = OlMailRecipientType.olCC Next You of course would have to declare that oRecip object somewhere prior to that loop. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "paresh" wrote in message ... Thanks Ken, I did below: For Each olkRecipient In objSafeMailItem.Recipients olkRecipient.Type = OlMailRecipientType.olCC rpl.Recipients.Add (olkRecipient.Name) Next Still it is adding it To list only all the recipients. Am I doing anything wrong? Thanks, Paresh |
Assign To and CC list while using Redemption.dll library
Ken, I have changes the Recipient.Name property to Recipient.Address and its
works perfect now. Thanks. "paresh" wrote: Thanks Ken, it works absolutely fine. See my below code: rpl.Recipients.Add (objSafeMailItem.Sender.Name) For Each olkRecipient In objSafeMailItem.Recipients Set odRecip = olkRecipient Set oRecip = rpl.Recipients.Add(olkRecipient.Name) oRecip.Type = odRecip.Type Next rpl.Recipients.ResolveAll I have only one problem in resolving the email addresses that are outside our domain. It resolves the our domain address perfectly but it can't if email address in outside the domain. I think this is happening because I am using Recipient.Name property. So suppose name="xxx yyy" and oririginal email id = " then it keeps "xxx yyy" in the recipients list and not resoving to original email id. Could you help me here. Thanks for being there. Paresh "Ken Slovak - [MVP - Outlook]" wrote: You are attempting to change the Type of the original recipients and hoping they will be that Type when added to a new mail item as recipients, and it just doesn't work that way. Any recipient object added to a mail item will be olTo unless you explicitly set its Type on the new Recipient object. For Each olkRecipient In objSafeMailItem.Recipients Set oRecip = rpl.Recipients.Add (olkRecipient.Name) oRecip.Type = OlMailRecipientType.olCC Next You of course would have to declare that oRecip object somewhere prior to that loop. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "paresh" wrote in message ... Thanks Ken, I did below: For Each olkRecipient In objSafeMailItem.Recipients olkRecipient.Type = OlMailRecipientType.olCC rpl.Recipients.Add (olkRecipient.Name) Next Still it is adding it To list only all the recipients. Am I doing anything wrong? Thanks, Paresh |
All times are GMT +1. The time now is 05:04 PM. |
|
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com