即使类型是密件抄送或抄送,使用 Office 互操作设置的最后收件人始终会出现在 Outlook2010 中的“收件人”字段中
我在 Outlook 2010 中设置密件抄送字段时遇到问题。 这是我的情况(使用 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
这在 Outlook 2007 中工作正常,但在 Outlook 2010 中,地址显示在“收件人”字段而不是“密件抄送”字段中。变量addedBCC 包含与bcc 相同的文本。我在这里做错了什么吗?
实际问题是,当添加多个不同类型的收件人时,在 Outlook 2010 中显示撰写窗口时,最后添加的收件人始终会出现在“收件人”字段中。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我正在 Outlook 2010 加载项中执行非常类似的操作...我确实确认获取 mailItem.BCC 将返回空字符串,即使在添加 BCC 收件人之后也是如此。但是,当最终显示撰写窗口时,密件抄送会在密件抄送字段中正确列为收件人。希望有帮助...
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...
我发现是什么给我带来了麻烦,但这并不完全是我在问题中描述的方式。
我不仅添加了 BCC,还添加了 CC 和 TO,并且按照 TO、CC、BCC 的顺序添加了它们。当我尝试这个时,我只添加了每种类型的一个地址,这让我相信 BCC 总是会出现在“TO”字段中,而事实上问题是我添加到“收件人”的最后一个地址最终出现在“收件人”字段中。至字段。
这意味着,通过更改添加收件人的顺序以添加到最后而不是添加到第一个,添加到抄送和密件抄送的地址最终将出现在正确的字段中。
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.