EnumReplications Method

This method lists the replication instances for the project.

Syntax

ReplicationProject.EnumReplications(State, Iterator)

Parameters

State

Queries for replications of a given state. The states are described in the following table.

State Value Description
REPL_STATE_EMPTY 0 Return all replications.
REPL_STATE_STARTING 1 Return only starting replications.
REPL_STATE_RUNNING 2 Return only running replications.
REPL_STATE_COMPLETE 3 Return only completed replications.
REPL_STATE_ABORTED 4 Return only aborted replications.
REPL_STATE_CANCELED 5 Return only canceled replications.
REPL_STATE_RECEIVING 6 Return only receiving replications.
REPL_STATE_PENDING 7 Return only pending replications.

Iterator

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

Remarks

When there are no more items to enumerate, EnumReplications sets the global error message to CRS_ERROR_NO_MORE_ITEMS.

Example

The following example lists when the replication was started, the number of files sent, the state of the replication, and the status of the replication for all replication instances for the Proj1 project.

Option Explicit 
On Error Resume Next

const CRS_ERROR_NO_MORE_ITEMS  = 0&80003B17
const OPEN_EXISTING_PROJECT  = 2
const REPL_STATE_EMPTY    = 0

Err.Clear

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

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

dim Iterator
Iterator = 0
dim Inst

dim ID
ID = 0

do while True
  
  'Get replication instance
  set Inst = ReplProject.EnumReplications(REPL_STATE_EMPTY, Iterator)

  'Quit if "No more items" error 
  if Err.Number = CRS_ERROR_NO_MORE_ITEMS then exit do
   
  'Quit if Instance is empty
  if IsEmpty(Inst) then
   Wscript.Echo "Instance object is empty."
   exit do
  end if

  'Quit if Instance is NULL
  if IsNull(Inst) then
   Wscript.Echo "Instance object is Null."
   exit do
  end if

  'Quit if we're looking at the same instance
  if ID = Inst.ID then exit do

  'Update Instance properties
  Inst.Query

  'Display Instance properties
  Wscript.Echo "Replication : " & Inst.ID & " properties:"
  Wscript.Echo "Started:   " & Inst.StartTime 
  Wscript.Echo "Ended:   " & Inst.EndTime 
  Wscript.Echo "Files sent:  " & Inst.FilesSent
  Wscript.Echo "State:   " & Inst.State
  Wscript.Echo "Status:    " & Inst.Staus

  'Save Instance ID
  ID = Inst.ID

Loop

'Release objects
set Inst        = Nothing
set ReplProject = Nothing
set ReplServer  = Nothing

See Also

Enum


© 1997-1998 Microsoft Corporation. All rights reserved.