Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Mark Event as Exception via Code
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Mark Event as Exception via Code

 Post Reply Post Reply
Author
Message
AndyWilton View Drop Down
Groupie
Groupie
Avatar

Joined: 03 June 2008
Status: Offline
Points: 82
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndyWilton Quote  Post ReplyReply Direct Link To This Post Topic: Mark Event as Exception via Code
    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
Back to Top
mbrogdon View Drop Down
Groupie
Groupie


Joined: 22 March 2007
Status: Offline
Points: 40
Post Options Post Options   Thanks (0) Thanks(0)   Quote mbrogdon Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
AndyWilton View Drop Down
Groupie
Groupie
Avatar

Joined: 03 June 2008
Status: Offline
Points: 82
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndyWilton Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.187 seconds.