Adding a Schedule Using Visual Basic

The following is a Visual Basic code fragment that adds a new schedule called "Extended Work Hours," which includes all hours on all days:

Dim root As New FPCLib.FPC
' Declare a schedule collection.
Dim mySchedules As FPCSchedules
' Declare a schedule object.
Dim newSchedule As FPCSchedule
' Retrieve the schedule collection of the current array.
Set mySchedules = root.GetContainingArray.PolicyElements.Schedules
' Add the new Schedule. 
Set newSchedule = mySchedules.Add("Extended Work Hours")
' Set the schedule days.
newSchedule.Set fpcALL_WEEK, fpcALL_DAY
' Save the changes.

Note that the changed schedule is not saved to persistent storage until the last line of code, where the Save method is called.

See Also

Modify a Schedule

Send comments about this topic to Microsoft

Build date: 11/30/2009

© 2008 Microsoft Corporation. All rights reserved.