如何使用邮箱地址从字符串中检索 Outlook.AddressEntry 对象?
How to retrieve Outlook.AddressEntry object from String with the mailbox address?
我有给定的字符串,例如 john@doe.com,我必须使用 C# VSTO 项目中的发件人 setter 在 MailItem 中将其设置为外发邮箱。
这是我的实际代码(我用完整的限定名称来表示我对 MailItem 的意思):
Microsoft.Office.Interop.Outlook.MailItem mailItem = (Microsoft.Office.Interop.Outlook.MailItem) Globals.ThisAddIn.Application.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
mailItem.Subject = "Order #1";
mailItem.To = "orderbot@doe.com";
mailItem.Sender = (Here has to be the EntryAddress)
mailItem.Display(false);
调用Namespace.CreateRecipient
/Recipient.Resolve
/使用Recipient.AddressEntry
.
为什么不设置MailItem.SentOnBehalfOfName
属性?
我有给定的字符串,例如 john@doe.com,我必须使用 C# VSTO 项目中的发件人 setter 在 MailItem 中将其设置为外发邮箱。
这是我的实际代码(我用完整的限定名称来表示我对 MailItem 的意思):
Microsoft.Office.Interop.Outlook.MailItem mailItem = (Microsoft.Office.Interop.Outlook.MailItem) Globals.ThisAddIn.Application.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
mailItem.Subject = "Order #1";
mailItem.To = "orderbot@doe.com";
mailItem.Sender = (Here has to be the EntryAddress)
mailItem.Display(false);
调用Namespace.CreateRecipient
/Recipient.Resolve
/使用Recipient.AddressEntry
.
为什么不设置MailItem.SentOnBehalfOfName
属性?