![]() |
| 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. |
|
|||||||
| Tags: saferecipients, use |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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.O lItemType.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 |
| Ads |
|
#2
|
|||
|
|||
|
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? |
|
#3
|
|||
|
|||
|
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" wrote in message oups.com... 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? |
|
#4
|
|||
|
|||
|
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" wrote in message oups.com... 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? |
| Thread Tools | |
| Display Modes | |
|
|