2011-01-10 15 views
4

私はいくつかの例外を除いてOutlookにシリーズを持っています。私がしたいことは、このシリーズのすべての例外を削除することです。これを行う方法があるかどうか誰にも知っていますか?例外リストは読み取り専用ですので、私は定期的なパターンをクリアしようとしていると、このような値はsans例外リストのすべてを再適用する:シリーズから例外を削除する

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を呼び出すと、すべてのデータを更新することはできません(または、とにかく維持されません)。そのため、保存を試みましたが、動作しません。より良い方法があり、私はただそれを逃しています。

予定項目の完全コピーを作成して削除/再追加することも考えましたが、可能な限り回避したいと思います。

答えて

1

私は答えを見つけ、誰かが必要とする場合はここに掲載します。あなたは例外リストをクリアするために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 
+1

これは、*すべての*例外をクリアすることに注意してください。 –

関連する問題