我有以下在 .Net 4.0 中构建的代码,它工作正常,但我现在必须在 .Net 3.5 中构建项目,并且在创建 MailItem 时出现错误。错误信息是:-
“'不能将类型'object'隐式转换为'microsoft.office.interop.outlook.olmailitem'”
Outlook.Application application = new Outlook.Application();
Outlook.Folder folder =
application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDrafts)
as Outlook.Folder;
Outlook.MailItem mail =
application.CreateItem(Outlook.OlItemType.olMailItem);
foreach (string name in addlist)
{
mail.Recipients.Add(name);
}
mail.BodyFormat = Outlook.OlBodyFormat.olFormatHTML;
mail.HTMLBody = msg;
mail.Subject = textBox1.Text;
mail.Save();
任何人都可以帮忙吗?我正在努力解决语法问题?