c# - 是否可以直接打开Outlook session 窗口?

标签 c# .net outlook-2016

我正在尝试让我的应用程序打开带有一些预填充字段的 Outlook session 窗口。

我发现这个问题已经有人问了here . 但是,答案中提供的代码(工作正常)不会打开 session 窗口,而是会打开约会窗口。这是在 Outlook 中以不同方式处理的两件不同的事情,而我确实需要 session 窗口。

有什么方法可以做到这一点,还是我必须先打开约会窗口,然后邀请其他人将其变成 session ?

最佳答案

像在另一个问题中一样创建约会,但随后设置约会的 MeetingStatus 属性。

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);

// This line was added    
appointmentItem.MeetingStatus = Microsoft.Office.Interop.Outlook.OlMeetingStatus.olMeeting;

appointmentItem.Subject = "Meeting Subject";
appointmentItem.Body = "The body of the meeting";
appointmentItem.Location = "Room #1";
appointmentItem.Start = DateTime.Now;
appointmentItem.Recipients.Add("test@test.com");
appointmentItem.End = DateTime.Now.AddHours(1);
appointmentItem.ReminderSet = true;
appointmentItem.ReminderMinutesBeforeStart = 15;
appointmentItem.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceHigh;
appointmentItem.BusyStatus = Microsoft.Office.Interop.Outlook.OlBusyStatus.olBusy;
appointmentItem.Recipients.ResolveAll();
appointmentItem.Display(true);

关于c# - 是否可以直接打开Outlook session 窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42676261/

相关文章:

c# - CancellationToken.Register(MyMethod)。什么情况下方法可能不被调用 方法执行顺序

c# - 计算多个日期/时间范围之间的交叉点的位置和数量?

css - 边界半径属性在 Outlook 中不起作用

css - Outlook 2016 - 具有默认行高的第一行,mso-line-height-rule 不起作用

outlook-addin - Harmon.ie 使 Outlook 2016 崩溃

c# - 当所有其他对象暂停时移动角色

c# - 具有缓存结果的属性或获取方法

c# - 属性更改时属性未将值传回文本框的问题

c# - MVC 中启用 Ajax 的 WCF 返回 404

c# - 尝试转换 listbox.selecteditem 时为空引用?