Enum Method

This method lists the parameters of a route.

Syntax

ReplicationRoute.Enum(Iterator, ParamName)

Parameters

Iterator

Used by the service to enumerate the list of parameters. This value should be initialized to zero, and should not be modified.

ParamName

Used by the service to return the name of the parameter. This value should be initialized to an empty string, "", and should not be modified.

Remarks

The only parameters that are listed are BaseDirectory, which you can set with either the BaseDirectory property or with the Put method, and Destinations, which you can set with the AddDestination method.

Example

The following example lists the names and values of all of the parameters for the Temp route.

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
dim RouteParam

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

  dim Name
  Name = ReplRoute.Name

  'We have a valid route. Check if it's the one we want
  if Name = "Temp" then
    dim RouteParam
    RouteParam = ""
    dim ParamValue

    do while True
    Err.Clear
    ParamValue = ReplRoute.Enum(Iterator, RouteParam)

    'Exit if we've looped past the last parameter
    if ParamValue = CRS_ERROR_NO_MORE_ITEMS then exit do

    Wscript.Echo "Parameter " & RouteParam & "= " & ParamValue
    Loop
  end if
  'We can exit now, since we already found our route
  exit do

loop
'Release objects
set ReplRoute  = Nothing
set ReplServer = Nothing

See Also

BaseDirectory, Get, Put


© 1997-1998 Microsoft Corporation. All rights reserved.