Previous in Contents Next in Contents

EnumItems Method

This method lists the replication item objects for the project.

Syntax

ReplicationProject.EnumItems(Directory, Iterator)

Parameters

Directory

Relative path to the directory to begin enumerating.

Iterator

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

Remarks

You must have Site Server Publishing administrator privileges on the server to call this method.

The EnumItems method returns the ReplicationItem objects in Directory in an enumerated list. The objects are the files for standard projects and containers for metabase projects.

Example

The following example displays the names of the replication items in the \LocalRep directory.

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 Project
set Project = ReplServer.OpenProject("Project1", OPEN_EXISTING_PROJECT)

dim Directory
Directory = "LocalRep"
Dim ReplItem
dim Iterator
Iterator = 0
dim ReplError

Wscript.Echo "The following items were replicated from " & Directory

do while True
  'Clear any error text
  Err.Clear
  'Get the next replication item
  set ReplItem = Project.EnumItems Directory, Iterator 

  'Display error message and quit if empty object returned
  if IsEmpty(ReplItem) then
    Wscript.Echo "Empty replication item returned."
    exit do
  end if

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

  Wscript.Echo ReplItem.Name
Loop
'Release objects
set ReplItem    = Nothing
set ReplProject = Nothing
set ReplServer  = Nothing

See Also

ReplicationItem


© 1997-2000 Microsoft Corporation. All rights reserved.