A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Assign To and CC list while using Redemption.dll library



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 27th 09, 08:20 AM posted to microsoft.public.outlook.program_vba
paresh
external usenet poster
 
Posts: 66
Default 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
Ads
  #2  
Old April 27th 09, 03:00 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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


  #3  
Old April 27th 09, 03:14 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default 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



  #4  
Old April 27th 09, 03:46 PM posted to microsoft.public.outlook.program_vba
paresh
external usenet poster
 
Posts: 66
Default 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




  #5  
Old April 27th 09, 04:12 PM posted to microsoft.public.outlook.program_vba
paresh
external usenet poster
 
Posts: 66
Default 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



  #6  
Old April 28th 09, 02:29 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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


  #7  
Old April 29th 09, 06:55 AM posted to microsoft.public.outlook.program_vba
paresh
external usenet poster
 
Posts: 66
Default 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



  #8  
Old April 29th 09, 02:11 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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


  #9  
Old April 30th 09, 06:28 AM posted to microsoft.public.outlook.program_vba
paresh
external usenet poster
 
Posts: 66
Default 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



  #10  
Old April 30th 09, 06:36 AM posted to microsoft.public.outlook.program_vba
paresh
external usenet poster
 
Posts: 66
Default 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



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign category to all members of a Distribution List SB Mull Outlook - Using Contacts 1 August 19th 08 01:25 AM
Suspect Redemption Library Issue??? Tom at GSD Add-ins for Outlook 6 March 29th 07 09:11 PM
Assign Task problem-Can't accept or assign DOL Outlook - Calandaring 5 June 29th 06 06:57 AM
Redemption library - Add distribution list as member to another distributionlist Tommy Ipsen Outlook - General Queries 0 June 2nd 06 10:23 PM
How to assign an ascending sort value to a list of contacts? dtcre Outlook - Using Contacts 1 May 19th 06 03:02 AM


All times are GMT +1. The time now is 05:05 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-2025 Outlook Banter.
The comments are property of their posters.