我正在编写一个Outlook 2007加载项,它构成了一个响应电子邮件查询的业务报价。我使用Windows窗体撰写报价。一切工作正常,直到我回复原始消息的报价信息。如何使用.net回复Outlook邮件项目
private void btnSend_Click(object sender, EventArgs e)
{
Outlook.MailItem theMail = ((Outlook._MailItem)quote.mailItem).Reply();
theMail.Subject = "This is the quote";
theMail.Body = <Some html composed elsewhere>;
Outlook.Recipient rcp = theMail.Recipients.Add("Joe Blow");
Outlook.AddressEntry ae = rcp.AddressEntry;
ae.Address = "[email protected]";
}
其中quote.mailItem
是传入的电子邮件请求。当我运行代码时,它会抛出执行rcp.AddressEntry
的异常。该错误是
'的对象不能找到'
。 我需要能够做的是添加和删除收件人以及设置CC和BCC字段在我发送之前在报价单上。收件人可能不在通讯簿中。我已经用其他邮件库完成了它,它应该很简单,但是我似乎在为Outlook咆哮错误的树。
编辑发现它 - 感谢德米特里指出我在正确的方向。
Outlook.Recipient rcp = theMail.Recipients.Add("joe blow <[email protected]>");
rcp.Type = (int)Outlook.OlMailRecipientType.olTo;
如果德米特里的答案是正确的,请评价和接受它:) – etalon11 2016-02-05 10:46:12
在梅德的回答提供的问题没有解决的分辨率,但他没把我弄到了,我感谢文件的适当区域他。 – Jon 2016-02-05 15:51:17