views:

23

answers:

2

I am having problems setting the BCC field in Outlook 2010. This is my situation (using Microsoft.Office.Interop.Outlook):

string bcc = "[email protected]";
Recipient recipient = mailItem.Recipients.Add(bcc); // Add the recipient address
recipient.Type = (int)OlMailRecipientType.olBCC; // Set the type to BCC
mailItem.Display(false); // Display the email in Outlook
string addedBCC = mailItem.BCC; // Check that the BCC property gets set

This works fine in outlook 2007, but in Outlook 2010 the address appears in the "To" field instead of the "BCC" field. The variable addedBCC contains the same text as bcc. Am I doing something wrong here?


The actual problem was that when adding several recipients with different types, the last recipient added would always end up in the TO field when displaying the compose window in outlook 2010.

A: 

I'm doing something very similar in my Outlook 2010 add-in... I did confirm that getting mailItem.BCC will return an empty string, even after adding a BCC recipient. But when the compose window is eventually displayed, the BCC is correctly listed as a recipent in the BCC field. Hope that helps...

Joel
For me, mailItem.BCC does contain the address "[email protected]" just like it should, but when displayed in outlook the address appears in the "To" field. If you confirmed it works for you though, I am probably missing something.
johgan
A: 

I found out what was causing me trouble and it was not exactly the way I described it in my question.

I was not only adding BCC but also CC and TO and I was adding them in the order TO, CC, BCC. When I was trying this out, I only added one address of each type and that led me to believe the BCC would always end up in the TO field, when in fact the issue was that the last address I added to Recipients ended up in the TO field.

This meant that by changing the order in which I added the recipients to add TO last instead of first, addresses added to CC and BCC would end up in the correct fields.

johgan