Print Page | Close Window

RecurrencePatterns

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=3240
Printed Date: 13 May 2024 at 8:02pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: RecurrencePatterns
Posted By: xmastree
Subject: RecurrencePatterns
Date Posted: 17 November 2005 at 4:04pm

Hi,

I am creating events with Recurrences, for example I have set the recurrence

to daily, this populates then entire calendar as required, I now want to remove all the recurring events. I use the remove recurrence on the event but  this does not remove all the recurring events. How do I remove all recurrences, I have checked for recurrencetype  = master but all the events still remain.

Can you please post  code snippet on how to remove All Recurrences in one delete.

Cheers in Advance




Replies:
Posted By: sserge
Date Posted: 18 November 2005 at 9:53am
Hi,

The example below is included with the next release.


Private Sub mnuDeleteEvent_Click()
    Dim bDeleted As Boolean
    bDeleted = False
    
    If ContextEvent.RecurrenceState = xtpCalendarRecurrenceOccurrence _
        Or ContextEvent.RecurrenceState = xtpCalendarRecurrenceException _
    Then
        frmOccurrenceSeriesChooser.m_bOcurrence = True
        frmOccurrenceSeriesChooser.m_bDeleteRequest = True
        frmOccurrenceSeriesChooser.m_strEventSubject = ContextEvent.Subject
       
        frmOccurrenceSeriesChooser.Show vbModal
       
        If frmOccurrenceSeriesChooser.m_bOK = False Then
             Exit Sub
        ElseIf Not frmOccurrenceSeriesChooser.m_bOcurrence Then
             ' Series
             CalendarControl.DataProvider.DeleteEvent ContextEvent.RecurrencePattern.MasterEvent
             bDeleted = True
        End If
    End If
       
    If Not bDeleted Then
        CalendarControl.DataProvider.DeleteEvent ContextEvent
    End If
    
    CalendarControl.Populate
    CalendarControl.RedrawControl
End Sub


--
HTH,
Serge


Posted By: xmastree
Date Posted: 18 November 2005 at 10:08am

Hi,

Thank you a very helpful example.

also I came across removeRecurrence this sets the recurrencetype to 0 and accorsing to the help notes this is now a non recurring event but when I update the event it still belongs to the recurrence series.

should it not be a standalone event at this point. as when I delete the series, this modified event which has no recurrence attached is also deleted can you  help explain why the calendar still thinks it is part of a recurrence

Cheers in Advance



Posted By: sserge
Date Posted: 19 November 2005 at 4:56am
Hi,

The property CalendarRecurrencePattern.MasterEvent returns a new object each time when called.

CalendarEvent.RecurrencePattern also returns new object each time for non-master event. For master event it returns the same internally associated pattern object.

So, the following code will take no effect:
pEvent.RecurrencePattern.MasterEvent.RemoveRecurrence


The example below should work correctly:

Public pMasterEvent As CalendarEvent

Set pMasterEvent = pEvent.RecurrencePattern.MasterEvent
pMasterEvent.RemoveRecurrence

CalendarControl.DataProvider.ChangeEvent pMasterEvent

CalendarControl.Populate
CalendarControl.RedrawControl


--
WBR,
Serge


Posted By: xmastree
Date Posted: 19 November 2005 at 1:50pm

Hi,

Thanks for the code

Cheers




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net