我如何读取Outlook RecurrencePattern.DayOfWeekMask的值?

问题描述 投票:0回答:1

我有一个简单的问题。我需要能够(在VB.NET中编程的Outlook VSTO中)读取约会项的RecurrencePattern.DayOfWeekMask属性的值。我在网上找到的所有示例仅显示了如何写入该属性,而不是读取它。文档kindasorta指示它返回一种Enum(?),但是

Dim aptItem As Outlook.AppointmentItem = TryCast(Globals.ThisAddIn.Application.ActiveInspector().CurrentItem, Outlook.AppointmentItem)

...

Dim oRecurrencePattern As Outlook.RecurrencePattern = aptItem.GetRecurrencePattern
For Each i In System.Enum.GetValues(oRecurrencePattern.DayOfWeekMask)

返回错误,指出他们无法将其转换为Type。

我对尝试其他方法有些困惑。在此先感谢您提供的任何帮助。

vb.net outlook vsto
1个回答
0
投票

DayOfWeekMask是一个int。您需要使用按位“和”(&)运算符来测试日期:

if ((oRecurrencePattern.DayOfWeekMask & OlDaysOfWeek.olMonday) != 0)
{
    //the appointment occurs on Monday
}
© www.soinside.com 2019 - 2024. All rights reserved.