CReplicationProject.EnumReplications Method
For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.
Retrieves the replication instances, that is, the deployments that are currently running on a server, for the Commerce Server Staging (CSS) project.
object EnumReplications(int state, ref object iterator)
Parameters
state
Queries for replications of a given state. The following table shows the possible queries and their values.State
Value
Description
REPL_STATE_EMPTY
0
Returns all replications.
REPL_STATE_STARTING
1
Returns only starting replications.
REPL_STATE_RUNNING
2
Returns only running replications.
REPL_STATE_SENT
3
Returns replications that were sent.
REPL_STATE_ABORTED
4
Returns replications that were aborted with an error.
REPL_STATE_CANCELED
5
Returns replications that were canceled.
REPL_STATE_RECEIVING
6
Returns replications that are in the process of being received at the destination.
REPL_STATE_PENDING
7
Returns replications that are pending.
REPL_STATE_PARTIAL
8
Returns replications that were partially completed.
REPL_STATE_COMPLETE
9
Returns only complete replications.
iterator
Used by the CSS service to enumerate the list of replications. This value should be initialized to 0 (zero) and should not be modified.
Return Value
A ReplicationInstance object for this iteration.
Remarks
You must have CSS administrator or operator rights to call this method.
This method sets the value of e.ErrorCode to -2147422485 (“No more items.”) to indicate the end of the enumeration.
The CReplicationProject.EnumReplications method corresponds to the COM method named ReplicationProject.EnumReplications.
Example
The following example lists when the replication was started, the number of files that were sent, the state of the replication, and the status of the replication for all replication instances for the project named Project1.
CReplicationServer replicationServer = new CReplicationServer();
replicationServer.Initialize("");
CReplicationProject replicationProject;
replicationProject = (CReplicationProject)replicationServer.OpenProject("Project1", CSS_PROJECT_CREATION.OPEN_EXISTING_PROJECT);
int iterator = 0;
object i = iterator as object;
CReplicationInstance replicationInstance;
int id = 0;
while (true)
{
try
{
replicationInstance = (CReplicationInstance)replicationProject.EnumReplications(0, ref i);
// Update Instance properties
replicationInstance.Query();
// Display Instance properties
Console.WriteLine("Replication {0} properties:", replicationInstance.ID);
Console.WriteLine("Started: {0}", replicationInstance.StartTime);
Console.WriteLine("Ended: {0}", replicationInstance.EndTime);
Console.WriteLine("Files sent: {0}", replicationInstance.FilesSent);
Console.WriteLine("State: {0}", replicationInstance.State);
Console.WriteLine("Status: {0}", replicationInstance.Status);
}
catch (System.Runtime.InteropServices.COMException e)
{
// Exit if "No more items" error
if (e.ErrorCode == -2147422485)
break;
else
throw e;
}
}
See Also
Other Resources
How to Start and Stop Project Replication
How to Retrieve Project Information
CReplicationProject.Enum Method
CReplicationInstance.State Property