Jaa


Scheduling a Project Sample

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

The following example schedules an existing Commerce Server Staging (CSS) project to run at specific times.

To run this sample, you must configure a computer to run CSS and replace the value of the constant MACHINE_NAME with the name of the computer. You must also have an existing CSS replication project named MyProject. For more information about creating a CSS replication project, see Creating Projects for Staging.

Option Explicit 
On Error Resume Next 

const MACHINE_NAME = "Adatum"
const CSS_SCHEDULE_REPLICATE = 2
const OPEN_EXISTING_PROJECT  = 2
const CSS_SCHEDULE_DAY_MONDAY  = 1
const CSS_SCHEDULE_DAY_FRIDAY  = 16

dim ReplicationServer
dim ReplicationProject
dim ReplicationSchedule

set ReplicationServer = CreateObject("CssApi.ReplicationServer")
ReplicationServer.Initialize(MACHINE_NAME)

Wscript.Echo "Opening the project."
set ReplicationProject = ReplicationServer.OpenProject("MyProject", OPEN_EXISTING_PROJECT)

Wscript.Echo "Scheduling the project to run Mondays and Fridays at 15:00."
set ReplicationSchedule = ReplicationProject.AddSchedule()
ReplicationSchedule.Days = CSS_SCHEDULE_DAY_MONDAY OR CSS_SCHEDULE_DAY_FRIDAY
ReplicationSchedule.Hour = "15"
ReplicationSchedule.ScheduledAction = CSS_SCHEDULE_REPLICATE
ReplicationSchedule.Commit

'Release the objects.
set ReplicationServer = Nothing
set ReplicationProject = Nothing
set ReplicationSchedule = Nothing

See Also

Other Resources

CReplicationServer Class

CReplicationProject Class

CReplicationSchedule Class

Creating Projects for Staging

COM Staging Examples