从系列中删除异常

发布于 2024-10-11 18:15:49 字数 1436 浏览 6 评论 0原文

我在 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,所有数据都无法更新(或者无论如何都不会持久),这就是我尝试保存但它不起作用的原因。一定有更好的方法,但我只是想念它。

我还考虑过制作约会项目的完整副本,然后删除/重新添加,但是,如果可能的话,我想避免这种情况。

I have a series in Outlook with a few exceptions. What I would like to do is remove all exceptions from this series. Does anyone know if there is a way to do this? Since the exceptions list is read-only I have tried clearing the recurrence pattern and re-applying all of the values sans the exceptions list like this:

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

Thus far I am having no luck with this approach. Once calling ClearRecurrencePattern all of the data cannot be updated (or will not persist anyways), which is why I tried the Save but, it does not work. There has to be a better way and I am just missing it.

I've also thought of doing a full copy of the appointment item and then delete/re-add but, I would like to avoid that if at all possible.

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

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

发布评论

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

评论(1

远山浅 2024-10-18 18:15:49

我找到了答案并将其发布在这里以防有人需要。您可以修改模式结束时间(我假设开始时间)以使其清除异常列表。下面的代码会导致从系列中删除所有异常。

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

I found the answer and will post it here in case anyone needs it. You can modify the patternendtime (and I am assuming start time) to cause it to clear the exceptions list. The code below causes all exceptions to be removed from the series.

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