Assign To and CC list while using Redemption.dll library

Status
Not open for further replies.
C

cGFyZXNo

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
 
K

Ken Slovak - [MVP - Outlook]

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.

"paresh" <paresh> wrote in message

news:FAD5023E-1F8D-46F4-9302-C5BD850E15F0@microsoft.com...
> 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
 
D

Dmitry Streblechenko

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)

-

"paresh" <paresh> wrote in message

news:FAD5023E-1F8D-46F4-9302-C5BD850E15F0@microsoft.com...
> 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
 
C

cGFyZXNo

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)
>

>

>

> -
> "paresh" <paresh> wrote in message
> news:FAD5023E-1F8D-46F4-9302-C5BD850E15F0@microsoft.com...
> > 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


>
 
C

cGFyZXNo

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

> >

>

> "paresh" <paresh> wrote in message
> news:FAD5023E-1F8D-46F4-9302-C5BD850E15F0@microsoft.com...
> > 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


>
 
K

Ken Slovak - [MVP - Outlook]

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

"paresh" <paresh> wrote in message

news:E84F349A-0807-4619-A6A7-EE11EA8793CB@microsoft.com...
> 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
 
C

cGFyZXNo

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

> >

>

> "paresh" <paresh> wrote in message
> news:E84F349A-0807-4619-A6A7-EE11EA8793CB@microsoft.com...
> > 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


>
 
K

Ken Slovak - [MVP - Outlook]

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.

"paresh" <paresh> wrote in message

news:54887605-1E4A-4C13-A974-6E30FEA21FA3@microsoft.com...
> 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
 
C

cGFyZXNo

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 = "xxxyyy@gmail.com" 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
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.

> >

>

> "paresh" <paresh> wrote in message
> news:54887605-1E4A-4C13-A974-6E30FEA21FA3@microsoft.com...
> > 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


>
 
C

cGFyZXNo

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 = "xxxyyy@gmail.com" 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

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

> >

> > "paresh" <paresh> wrote in message
> > news:54887605-1E4A-4C13-A974-6E30FEA21FA3@microsoft.com...
> > > 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

> >
 
K

Ken Slovak - [MVP - Outlook]

The name will only resolve correctly for an entry in your GAL or your

Contacts folder. As you found, the Recipient.Address is more universal.

"paresh" <paresh> wrote in message

news:4FEBAA69-2174-416E-B4C6-C1CE0FFB1EFF@microsoft.com...
> 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 = "xxxyyy@gmail.com" 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
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
P Can I Assign Put a Public Folder on a Tasks's Update List? Using Outlook 5
D Update List clears after sending to assign person. Using Outlook 1
R Assign Categories "Round Robin" style but in a shared mailbox but on specific emails only Outlook VBA and Custom Forms 8
P Auto assign shared mailbox Outlook VBA and Custom Forms 1
D Assign categories to outgoing emails Outlook VBA and Custom Forms 0
F How to assign a task to a public task folder? Using Outlook 1
A How to assign the value returned by the regex execute function to a variable? Using Outlook 1
soadfan assign category (VBA) Using Outlook 7
Diane Poremsky Assign one task to several people New Slipstick.com Articles 0
Diane Poremsky Assign an Email Account to an Outlook Contact New Slipstick.com Articles 0
E for Mac: Assign Task not available!? Using Outlook 1
E Outlook VBA to print attached Pdf to a fax printer and assign fax number Using Outlook 0
A Assign a unique number to every message I send Using Outlook 0
Z assign unique number email Using Outlook 8
T How to Assign Retention Tags for Notes Items in Exchange/Outlook 2010? Exchange Server Administration 0
L Can you use Exchange 2010 to control which users may or may not assign tasks to other users in Outlo Exchange Server Administration 2
N Assign Task from shared Task folder error Using Outlook 3
Q Don't have right permissions to assign "send as" rights in Exchange 2010 SP1 Exchange Server Administration 7
I Outlook 2010 Archiving Assign Policy Greyed out Using Outlook 1
C How do you assign a color to emails that are only colorized if received from a specific person? Using Outlook 2
F Any way to add emails to favourites or assign shortcuts to them? Using Outlook 5
M I have added an Assign Task button to a cutom group in the Tasks Ribbon. When I click on it I get a Using Outlook 3
P Can I Assign Outlook Tasks to a Public Folder? Using Outlook 1
C Y i cannot assign service to the newly added EXCHANGE certificate? Exchange Server Administration 6
C How to assign certificate(s) to an CAS array? Exchange Server Administration 1
C how should i assign an SSL certificate to a CAS array? Exchange Server Administration 2
A Outlook 2010 - assign a color category to email Using Outlook 2
D assign &amp; accept tasks using an IMAP email system Using Outlook 2
M Re: Exchange 2010 Resource forest - How do you assign permissions to share linked mailboxes? Exchange Server Administration 3
M Exchange 2010 Resource forest - How do you assign permissions to share linked mailboxes? Exchange Server Administration 7
D Assign rbac to specific group does not take affect. Exchange Server Administration 15
B Exchaneg 2010 SP1 Possible Bug, Cannot create move to archive retention tag on inbox, but can create a new one and edit and assign inbox to it Exchange Server Administration 3
J Assign a signature by external or internal reciepents. Outlook VBA and Custom Forms 1
P VBA to assign category on calendar item does not work ?? why ?? Outlook VBA and Custom Forms 5
S assign task programmatically Outlook VBA and Custom Forms 2
C Cannot assign a task from a public folder? Outlook VBA and Custom Forms 4
C How to assign icon to a button in Outlook Add-in Outlook VBA and Custom Forms 1
C Why won't Title display in message list? Using Outlook 1
T Increasing the number of items that appear on the Categories list Using Outlook 2
J Edit auto-complete list in Outlook 2016+/365? Using Outlook 0
M Changing the preferred order for "Put this entry in" list for adding new contacts to the Address Book Using Outlook 1
R List folders in a combo box + select folder + move emails from inbox to that folder + reply to that email Outlook VBA and Custom Forms 1
B See "Change View" Drop Down as a List? Using Outlook 1
B How to show concatenated categories in list task view? Using Outlook 2
M How can we find the list of users who are members of a deleted distribution list? Exchange Server Administration 2
B Outlook 365 - Folder pane list clears Using Outlook 24
B All imported tasks appear in to-do list Using Outlook 3
W Remove specific contacts from contact list Outlook VBA and Custom Forms 3
GregS 2016 Contact List being managed by Outlook.com? Using Outlook 1
B Outlook - Mail from safe senders list being sent to Spam Folder Using Outlook 0
Similar threads


















































Top