Share via


Modify a Schedule

The following Visual Basic code fragment modifies the schedule example shown in Add a Schedule by using the UnSet method of the FPCSchedule object. The "Extended Work Hours" schedule is changed so that it includes all hours of the day, but only the days Monday through Friday. This is done by unsetting the days Saturday and Sunday:

Dim root As New FPCLib.FPC
' Declare a schedule collection.
Dim mySchedules As FPCSchedules
' Declare a schedule object.
Dim mySchedule As FPCSchedule
' Get the schedule collection of the current array.
Set mySchedules = root.GetContainingArray.PolicyElements.Schedules
' Retrieve the "Extended Work Hours" schedule.
Set mySchedule = MySchedules("Extended Work Hours")
' Remove Saturday and Sunday from the schedule.
mySchedule.Unset fpcSAT, fpcALL_DAY
mySchedule.Unset fpcSUN, fpcALL_DAY
' Save changes.
mySchedules.Save

Again, note that the changes will not be saved to persistent storage until the last line of code, where the Save method is called.

See Also

FPCSchedule
Add a Schedule

Send comments about this topic to Microsoft

Build date: 6/30/2010