Accessing ReplicationRoute Objects

You access an existing ReplicationRoute object by calling the ReplicationServer.EnumRoutes method, as in the following example, where ReplRoute is the name you give to the new ReplicationRoute object:

Option Explicit 
On Error Resume Next

const CRS_ERROR_NO_MORE_ITEMS  = 0&80003B17

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

dim Iterator
Iterator = 0

dim ReplRoute

do while True
  'Clear any error text
  Err.Clear
  'Get a route
  set ReplRoute = ReplServer.EnumRoutes(Iterator)

  'Quit if empty object returned (no more instances)
  if IsEmpty(ReplRoute) then exit do

  'Quit if "No more items" error 
  dim ReplError
  ReplError = Err.Number
  if ReplError = CRS_ERROR_NO_MORE_ITEMS then exit do

  'You now have a good route
  ...
loop

'Release objects
set ReplRoute  = Nothing
set ReplServer = Nothing

© 1997-1998 Microsoft Corporation. All rights reserved.