如何从VB6代码中移除特定异常处理?
- 内容介绍
- 文章标签
- 相关推荐
本文共计512个文字,预计阅读时间需要3分钟。
我有一个Outlook系列,但有些例外。我想做的是删除基本系列中的所有异常。有人知道有没有办法做到这一点吗?由于例外列表是只读的,我已经尝试了清除重复发生模式并重新应用所有值,但不起作用。
Dim tRType As OlRecurrenceType Dim tRPSD As Date Dim tRPED As Date Dim tST As Date Dim tET As Date Dim tOcc As Integer Dim tInterval As Integer tRType = oAppointmentItem.GetRecurrencePattern.RecurrenceType tRPSD = oAppointmentItem.GetRecurrencePattern.PatternStartDate tRPED = oAppointmentItem.GetRecurrencePattern.PatternEndDate tST = oAppointmentItem.GetRecurrencePattern.startTime tET = oAppointmentItem.GetRecurrencePattern.endTime tOcc = oAppointmentItem.GetRecurrencePattern.Occurrences tInterval = oAppointmentItem.GetRecurrencePattern.Interval oAppointmentItem.ClearRecurrencePattern ' This save throws an error. 'oAppointmentItem.Save ' Make this call to flip to reccurring... oAppointmentItem.GetRecurrencePattern oAppointmentItem.GetRecurrencePattern.RecurrenceType = tRType oAppointmentItem.GetRecurrencePattern.PatternStartDate = tRPSD oAppointmentItem.GetRecurrencePattern.PatternEndDate = tRPED oAppointmentItem.GetRecurrencePattern.startTime = tST oAppointmentItem.GetRecurrencePattern.endTime = tET oAppointmentItem.GetRecurrencePattern.Occurrences = tOcc oAppointmentItem.GetRecurrencePattern.Interval = tInterval
到目前为止,我对这种方法没有运气.一旦调用ClearRecurrencePattern,所有数据都无法更新(或者无论如何都不会持久),这就是为什么我尝试了Save但是,它不起作用.必须有一个更好的方法,我只是错过了它.
我还想过做一个约会项目的完整副本然后删除/重新添加,但是,如果可能的话,我想避免这样做.
我找到了答案并将其发布在此处以防万一有需要.您可以修改patternendtime(我假设开始时间)以使其清除例外列表.下面的代码会导致从系列中删除所有异常.Dim tEndDate As Date Dim currentEndDate As Date Dim dateInterval As Double currentEndDate = oAppointmentItem.GetRecurrencePattern.PatternEndDate tEndDate = oAppointmentItem.GetRecurrencePattern.PatternEndDate ' Add a year to the end date so we can force the exceptions to remove. DateAdd "yyyy", 1, tEndDate oAppointmentItem.GetRecurrencePattern.PatternEndDate = tEndDate oAppointmentItem.GetRecurrencePattern.PatternEndDate = currentEndDate
本文共计512个文字,预计阅读时间需要3分钟。
我有一个Outlook系列,但有些例外。我想做的是删除基本系列中的所有异常。有人知道有没有办法做到这一点吗?由于例外列表是只读的,我已经尝试了清除重复发生模式并重新应用所有值,但不起作用。
Dim tRType As OlRecurrenceType Dim tRPSD As Date Dim tRPED As Date Dim tST As Date Dim tET As Date Dim tOcc As Integer Dim tInterval As Integer tRType = oAppointmentItem.GetRecurrencePattern.RecurrenceType tRPSD = oAppointmentItem.GetRecurrencePattern.PatternStartDate tRPED = oAppointmentItem.GetRecurrencePattern.PatternEndDate tST = oAppointmentItem.GetRecurrencePattern.startTime tET = oAppointmentItem.GetRecurrencePattern.endTime tOcc = oAppointmentItem.GetRecurrencePattern.Occurrences tInterval = oAppointmentItem.GetRecurrencePattern.Interval oAppointmentItem.ClearRecurrencePattern ' This save throws an error. 'oAppointmentItem.Save ' Make this call to flip to reccurring... oAppointmentItem.GetRecurrencePattern oAppointmentItem.GetRecurrencePattern.RecurrenceType = tRType oAppointmentItem.GetRecurrencePattern.PatternStartDate = tRPSD oAppointmentItem.GetRecurrencePattern.PatternEndDate = tRPED oAppointmentItem.GetRecurrencePattern.startTime = tST oAppointmentItem.GetRecurrencePattern.endTime = tET oAppointmentItem.GetRecurrencePattern.Occurrences = tOcc oAppointmentItem.GetRecurrencePattern.Interval = tInterval
到目前为止,我对这种方法没有运气.一旦调用ClearRecurrencePattern,所有数据都无法更新(或者无论如何都不会持久),这就是为什么我尝试了Save但是,它不起作用.必须有一个更好的方法,我只是错过了它.
我还想过做一个约会项目的完整副本然后删除/重新添加,但是,如果可能的话,我想避免这样做.
我找到了答案并将其发布在此处以防万一有需要.您可以修改patternendtime(我假设开始时间)以使其清除例外列表.下面的代码会导致从系列中删除所有异常.Dim tEndDate As Date Dim currentEndDate As Date Dim dateInterval As Double currentEndDate = oAppointmentItem.GetRecurrencePattern.PatternEndDate tEndDate = oAppointmentItem.GetRecurrencePattern.PatternEndDate ' Add a year to the end date so we can force the exceptions to remove. DateAdd "yyyy", 1, tEndDate oAppointmentItem.GetRecurrencePattern.PatternEndDate = tEndDate oAppointmentItem.GetRecurrencePattern.PatternEndDate = currentEndDate

