Jaa


CReplicationServer.EnumReplications Method

Retrieves the replications that are running on the Commerce Server Staging (CSS) server.

object EnumReplications(string matchProject, int matchState, ref object iterator)

Parameters

  • matchProject
    The name of the project or projects to enumerate. If the value is an empty string (""), the replication instances of all projects will be enumerated.

  • matchState
    The replication states associated with the replications to be retrieved. Only replication instances in the specified states will be enumerated.

    The following table lists the valid replication states.

    State

    Value

    Description

    REPL_STATE_EMPTY

    0

    Invalid state.

    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 completed with errors.

    REPL_STATE_DONE

    9

    Returns replications that completed successfully.

  • iterator
    Used by the service to enumerate the list of replication instances. This value should be initialized to 0 (zero) and should not be modified.

Return Value

The CReplicationInstance object for this iteration.

Remarks

You must have CSS administrator or operator permissions to call this method.

This method sets e.ErrorCode to -2147422485 (“No more items.”) and returns an empty CReplicationInstance object to indicate the end of the enumeration.

The CReplicationServer.EnumReplications method corresponds to the COM method named ReplicationServer.EnumReplications.

Example

The following example displays the names of all replications that are pending.

CReplicationServer replicationServer = new CReplicationServer();
  replicationServer.Initialize("");
  Console.WriteLine("The following replications are pending:");
  int iterator = 0;
  object i = iterator as object;
  while (true)
  {
      try
      {
          CReplicationInstance replicationInstance = (CReplicationInstance)replicationServer.EnumReplications("", 7, ref i);
          Console.WriteLine(replicationInstance.Name);
      }
      catch (System.Runtime.InteropServices.COMException e)
      {
          // Quit if "No more items" error
          if (e.ErrorCode == -2147422485)
              break;
          else if (e.ErrorCode == -1073680672)
          {
            Console.WriteLine("Replication not found");
                break;
             }
             else
                throw e;
      }
  }

See Also

Other Resources

Managing the CSS Service

How to Retrieve Staging Information

How to Retrieve Project Information

CReplicationInstance Class

CReplicationServer Class