c#winforms:打开outlook收件箱页面的按钮(outlook保存在计算机中)
我打算在单击按钮时打开outlook收件箱页面(见图)。我使用下面的代码,但什么也没发生。希望能得到一些帮助c#winforms:打开outlook收件箱页面的按钮(outlook保存在计算机中),outlook,Outlook,我打算在单击按钮时打开outlook收件箱页面(见图)。我使用下面的代码,但什么也没发生。希望能得到一些帮助 private void button6_Click(object sender, EventArgs e) { Microsoft.Office.Interop.Outlook.Application outlookApplication = new Microsoft.Office.Interop.Outlook.Application(); ;
private void button6_Click(object sender, EventArgs e)
{
Microsoft.Office.Interop.Outlook.Application outlookApplication = new Microsoft.Office.Interop.Outlook.Application(); ;
Microsoft.Office.Interop.Outlook.AppointmentItem appointmentItem = (Microsoft.Office.Interop.Outlook.AppointmentItem)outlookApplication.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
}
我检查了你的代码,没有问题。因此,您需要跟踪WindowsForm应用程序的错误消息,并确认已关闭Outlook。通常,您可能会遇到有关COM ID问题的错误 请参阅以下连结: 代码: 调试错误:
尝试以下方法(从我的头顶上):
我设法解决了自己的问题。我在最初的问题中没有说明,但outlook应用程序已经在我的笔记本电脑中下载了
private void button6_Click(object sender, EventArgs e)
{
Process.Start("outlook.exe");
}
多亏了yall的所有建议嗨,Simon,我已经检查了上面的链接并遵循了dcomcnfg的内容,我找不到outlook邮件附件,所以可能不是COM问题?a实际上我上面的代码,一旦我按下按钮,我的任务栏上将弹出一个窗口,说明:另一个程序正在使用outlook。要断开程序并退出outlook,请单击outlook图标,然后单击立即退出。实际上,我没有打开outlook,当我检查控制面板时,outlook也没有运行。也许有些程序正在使用outlook,我想你需要检查一下。
Outlook.Application oApp = new Outlook.Application ();
Outlook.Namespace ns = oApp.GetNamespace("MAPI");
ns.Logon();
Outlook.MAPIFolder inbox = ns.GetDEfaultFolder(olFolderInbox);
if (oApp.Explorers.Count > 0)
{
Outlook.Explorer expl = oApp.Explorers[1];
expl.CurrentFolder = inbox;
}
else
{
inbox.Display();
}
private void button6_Click(object sender, EventArgs e)
{
Process.Start("outlook.exe");
}