Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: Use of SafeRecipients

Geek News

Use of SafeRecipients
"Jonatan" <jonatan.hortelano[ at ]gmail.com> 2/2/2006 11:05:17 AM
Hi all,

I have started to use Redemption today and I am getting a problem that
is quite likely to be my fault!!

I just want to display the AddressBook select recipients and send the
email. For some reason the safeMailItem recipients list does not get
updated and the program fails with error 0x80004005.

I suppose that I do not need to loop through the returned list of
recipients and populate the recipients list of the SafeMailItem!!!

My code is the following


Outlook.MailItem mailItem = (Outlook.MailItem)
this.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);

Redemption.SafeMailItem sMailItem = new
Redemption.SafeMailItem();

mailItem.Subject = "Hello";

sMailItem.Item = mailItem;

Redemption.MAPIUtils mapiUtils = new
Redemption.MAPIUtils();
Redemption.SafeRecipients recipients =
sMailItem.Recipients;

recipients = (Redemption.SafeRecipients)
mapiUtils.AddressBook(recipients, "Select Name", false, true, 3, "To",
"Cc", "Bcc", 0);

//This method displays 1 if I selected one recipient
MessageBox.Show("" + recipients.Count);

// This one displays always 0
MessageBox.Show("" + sMailItem.Recipients.Count);

// As a result when I send the item it fails because
there are no recipients
sMailItem.Send();

Thank you for your help

Jonatan

Re: Use of SafeRecipients
"Jonatan" <jonatan.hortelano[ at ]gmail.com> 2/2/2006 11:48:01 AM
Hi all,

I realised that the recipients object returned by the AddressBook is a
copy so I need to update the Recipients from the SafeMailItem.

How can I do that without going though one by one?

Re: Use of SafeRecipients
"Sue Mosher [MVP-Outlook]" <suemvp[ at ]outlookcode.com> 2/2/2006 3:29:19 PM
You will need to iterate the SafeRecipients collection. It would be the same if you were using CDO and Session.AddressBook.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Jonatan" <jonatan.hortelano[ at ]gmail.com> wrote in message news:1138880881.629240.262660[ at ]g49g2000cwa.googlegroups.com...
[Quoted Text]
> Hi all,
>
> I realised that the recipients object returned by the AddressBook is a
> copy so I need to update the Recipients from the SafeMailItem.
>
> How can I do that without going though one by one?
>
Re: Use of SafeRecipients
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 2/2/2006 3:30:29 PM
You need to get the Recipients collection of the SafeMailItem as
SafeRecipients, and then one by one add the returned recipients to that
SafeRecipients collection, using the Add or AddEx methods of the
SafeRecipients collection.

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


"Jonatan" <jonatan.hortelano[ at ]gmail.com> wrote in message
news:1138880881.629240.262660[ at ]g49g2000cwa.googlegroups.com...
[Quoted Text]
> Hi all,
>
> I realised that the recipients object returned by the AddressBook is a
> copy so I need to update the Recipients from the SafeMailItem.
>
> How can I do that without going though one by one?
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net