This method lists the projects on a server.
Syntax
ReplicationServer.EnumProjects(Iterator)
Parameters
Iterator
Used by the service to enumerate the list of parameters. This value should be initialized to zero, and should not be modified.
Remarks
This method returns CRS_ERROR_NO_PROJECTS when there are no projects defined on the server.
Example
The following example displays the names of the projects on the server.
Option Explicit
On Error Resume Next
const CRS_ERROR_NO_PROJECTS = 15100
const CRS_ERROR_NO_MORE_ITEMS = 0&80003B17
dim ReplServer
set ReplServer = CreateObject("CrsApi.ReplicationServer")
ReplServer.Initialize("")
dim Project
dim Iterator
Iterator = 0
Wscript.Echo "The projects are:"
do while True
'Clear any error text
Err.Clear
'Get the next project
set ReplProject = ReplServer.EnumProjects(Iterator)
'Display error message and
'Quit if empty object returned (no more instances)
if IsEmpty(ReplProject) then
Wscript.Echo "Empty project object returned."
exit do
end if
'Display error message and
'Quit if "No projects defined" error
dim ReplError
ReplError = Err.Number
if ReplError = CRS_NO_PROJECTS then
Wscript.Echo "No projects defined."
exit do
end if
'Display error message and
'Quit if "No more items" error (we've reached the end of the list)
if ReplError = CRS_ERROR_NO_MORE_ITEMS then exit do
Wscript.Echo ReplProject.Name
Loop
'Release objects
set ReplProject = Nothing
set ReplServer = Nothing
See Also
DeleteProject, OpenProject, ReplicationProject