为什么 Appointment.Conflicts.Count 始终为 0?

发布于 2024-12-15 08:17:22 字数 565 浏览 3 评论 0原文

我正在使用 C# 来查看 Outlook 日历中的所有约会,并尝试找出是否有任何冲突,但是当我检查 Appointment.Conflicts.Count 时,它始终为 0,即使我添加了多个同时进行的约会。

以下是一些示例代码:

var outlook = new Microsoft.Office.Interop.Outlook.Application();
var calendar = outlook.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);

Outlook.AppointmentItem appointment;
foreach (Outlook.AppointmentItem item in calendar.Items)
{
    if (item.Conflicts.Count > 0)
    {
        Console.WriteLine("Never gets hit");
    }

}

如何以 C# 编程方式确定 Outlook 中的约会是否与另一个约会冲突?

I'm using C# to go through and get all of my appointments in my outlook calender and trying to figure out if I have any conflicts, but when I check Appointment.Conflicts.Count, it's always 0, even though I've added multiple appointments that occur at the same time.

Here's some example code:

var outlook = new Microsoft.Office.Interop.Outlook.Application();
var calendar = outlook.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);

Outlook.AppointmentItem appointment;
foreach (Outlook.AppointmentItem item in calendar.Items)
{
    if (item.Conflicts.Count > 0)
    {
        Console.WriteLine("Never gets hit");
    }

}

How do I determine if an appointment in Outlook conflicts with another appointment programmatically in C#?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

久夏青 2024-12-22 08:17:22

冲突属性似乎仅用于处理编辑冲突,而不用于处理计划冲突。

请参阅:标准 Outlook 项目类型的冲突解决

另请注意,几乎所有 outlook 项目类型也有冲突属性,即使是那些没有调度属性的类型(例如NoteItem)。

看来您必须通过appointmentItem.Start 和appointmentItem.End 属性以及AllDayEvent 属性自行检查日期范围。

It appears the Conflicts property is only for dealing with edit conflicts, not with scheduling conflicts.

See: Conflict Resolution for Standard Outlook Item Types

Also note that nearly all of the outlook item types also have a conflicts property, even those that don't have scheduling properties (e.g. NoteItem).

It appears you will have to examine the date ranges yourself via the appointmentItem.Start and appointmentItem.End properties, and perhaps the AllDayEvent property as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文