Previous in Contents Next in Contents

Enum Method

This method lists the properties of a route.

Syntax

ReplicationRoute.Enum(Iterator, PropName)

Parameters

Iterator

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

PropName

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

Remarks

The only properties that are listed are BaseDirectory, which you can set with either the BaseDirectory property or 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 properties 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 RouteProp
    RouteProp = ""
    dim PropValue

    do while True
    Err.Clear
    PropValue = ReplRoute.Enum(Iterator, RouteProp)

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

    Wscript.Echo "Property " & RouteProp & "= " & PropValue
    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-2000 Microsoft Corporation. All rights reserved.