Previous in Contents Next in Contents

Accessing ReplicationSchedule Objects

You access an existing ReplicationSchedule object by calling the ReplicationProject.EnumSchedules method, as in the following example, where ReplSched is the name you give to the new ReplicationSchedule object:

Option Explicit 
On Error Resume Next

const OPEN_EXISTING_PROJECT  = 2
const CRS_ERROR_NO_MORE_ITEMS  = 0&80003B17

dim ReplServer
set ReplServer = CreateObject("CrsApi.ReplicationServer")
ReplServer.Initialize("")

dim ReplProject
set ReplProject = ReplServer.OpenProject("MyProject", OPEN_EXISTING_PROJECT)

dim ReplSched

do while True
  Err.Clear
  set ReplSched = ReplProject.EnumSchedules

  if IsEmpty(ReplSched) then exit do
  if ReplSched = CRS_ERROR_NO_MORE_ITEMS then exit do

  'We have a valid schedule
  ...

  'Release Schedule object
 loop
'Release objects
set ReplSched   = Nothing
set ReplProject = Nothing
set ReplServer  = Nothing

© 1997-2000 Microsoft Corporation. All rights reserved.