Print Page | Close Window

Mark Event as Exception via Code

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=15231
Printed Date: 11 May 2024 at 4:47am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Mark Event as Exception via Code
Posted By: AndyWilton
Subject: Mark Event as Exception via Code
Date Posted: 23 September 2009 at 10:08am

Hi All,

 

I'm trying to either mark or delete some occurrences of a Recurring Event via some code that is executed by a button press.

 

To be honest, I'm struggling to even mark an event as an exception let alone delete it.  I've tried various code combinations - none with success.  Some of the things I've tried include:-

 

on the button press after selecting an event -

 

pMasterEvent = ?OLE{'ActiveView.GetSelectedEvents.ViewEvent(0).Event.RecurrencePattern.MasterEvent'}
pPatternObj = ?OLE{pMasterEvent & '.RecurrencePattern'}
pRecurObj = ?OLE{'ActiveView.GetSelectedEvents.ViewEvent(0).Event'}

 

?OLE{pRecurObj & '.MakeAsRException'}

?OLE{pMasterEvent & '.RecurrencePattern.SetException(' & pRecurObj & ')'}

?OLE{pMasterObj & '.UpdateRecurrence(' & pPatternObj & ')'}
?OLE{'DataProvider.ChangeEvent(' & pRecurObj & ')'}
?OLE{'DataProvider.ChangeEvent(' & pMasterEvent & ')'}

?OLE{'Populate'}
?OLE{'RedrawControl'}

 

OR

 

on the SelectedChanged event when a Calendar Event has been selected -

 

pMasterObj  = OLEControlFEQ{'ActiveView.HitTest.ViewEvent.Event.RecurrencePattern.MasterEvent'}
pPatternObj = OLEControlFEQ{pMasterObj & '.RecurrencePattern'}

OLEControlFEQ{pPatternObj & '.Exceptions.SetException.Add(' & OLEControlFEQ{'ActiveView.HitTest.ViewEvent.Event'} & ')'}

OLEControlFEQ{pMasterObj & '.UpdateRecurrence(' & pPatternObj & ')'}
OLEControlFEQ{'DataProvider.ChangeEvent(' & pMasterObj & ')'}

 

 

 

Obviously it’s something that I've either missed or misunderstood.

 

I'd really appreciate some help and guidance on the steps needed to delete an occurrence of a Recurring Event.

 

Many thanks in advance,

 

Andy

 

PS.  I do have a full annual subscription (well, 2 actually because of 2 difference companies J)



-------------
Product: Xtreme SuitePro (ActiveX) v11.2.1 -> v15.2.1
Platform: Windows XP / Vista / Win 7
Language: Clarion 5.5 -> C8.x
======================================
Andy Wilton



Replies:
Posted By: mbrogdon
Date Posted: 24 September 2009 at 6:07am
Hi Andy,
 
See the bold lines for key to deleting an exception occurence. You must first create an event, the set it as deleted (it will actually exist in the database), but the calendar will know not to display it because of the deleted flag.
 
 
 
      Set excepEv = m_pCalendar.DataProvider.CreateEventEx(InEvent.EventId)
      excepEv.StartTime = InEvent.RExceptionStartTimeOrig
      excepEv.EndTime = InEvent.RExceptionEndTimeOrig
      excepEv.MakeAsRExceptionEx YOURPatternID
      With excepEv
         .Subject = InEvent.Subject
         .Location = InEvent.Location
         .Body = InEvent.Body
         .MeetingFlag = InEvent.IsMeeting
         .PrivateFlag = InEvent.IsPrivate
         .Label = InEvent.LabelID
         .BusyStatus = InEvent.BusyStatus
         .Importance = InEvent.ImportanceLevel
         .StartTime = InEvent.StartDateTime
         .EndTime = InEvent.EndDateTime
         .AllDayEvent = InEvent.IsAllDayEvent
         .Reminder = InEvent.IsReminder
         .ReminderMinutesBeforeStart = InEvent.ReminderMinutesBeforeStart
         .ReminderSoundFile = InEvent.ReminderSoundFile
         .CustomProperties.LoadFromString InEvent.CustomPropertiesXMLData
         .ScheduleID = InEvent.ScheduleID
         If InEvent.IsRecurrenceExceptionDeleted = True Then
            .SetRExceptionDeleted True
         End If
      End With
      blnDisAllowUpdates = True
      m_pCalendar.DataProvider.ChangeEvent excepEv
      m_pCalendar.Populate


-------------
Xtreme SuitePro ActiveX 13.2.0 - Windows XP SP3 - VB6/Ingres Openroad 2006


Posted By: AndyWilton
Date Posted: 28 September 2009 at 6:03pm
Hi,
 
I've tried the code you've suggested but its still not working .  I tried it on a keypress of a button and also on the Selection Changed event.
 
I don't want to be cheeky but do you have any other ideas? or can you explain the process a little further?
 
Thanks in advance,
 
Andy


-------------
Product: Xtreme SuitePro (ActiveX) v11.2.1 -> v15.2.1
Platform: Windows XP / Vista / Win 7
Language: Clarion 5.5 -> C8.x
======================================
Andy Wilton



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