Freigeben über


CReplicationProject.Rollback Method

Reverts the files that were replicated for a Web content project to a previous Commerce Server Staging (CSS) replication. The Rollback method is valid only for Web content projects.

void Rollback(int numRollbacks)

Parameters

  • numRollbacks
    The number of rollbacks to perform.

Remarks

You must have CSS administrator or operator rights on the server to call this method. The Rollback method is available only under the following circumstances:

  • The project successfully completed replication on the endpoint server.

  • You have enabled the TransactionMethod parameter for the project, or you have enabled the TransactionMethod parameter on the endpoint server.

  • You have not exceeded the number of rollbacks that are enabled for the endpoint server.

The CReplicationProject.Rollback method corresponds to the COM method named ReplicationProject.Rollback.

Example

The following example cancels the project named Project1 and rolls the replication back to its previous state if it was aborted (state=4). For information about the replication state of a project, see GetProjectStatus.

CReplicationServer replicationServer = new CReplicationServer();
  replicationServer.Initialize("");
  CReplicationProject replicationProject;
  replicationProject = (CReplicationProject)replicationServer.OpenProject("Project1", CSS_PROJECT_CREATION.OPEN_EXISTING_PROJECT);
  CReplicationInstance replicationInstance;
  replicationInstance = (CReplicationInstance)replicationProject.Start(0);
  int state;
  state = (int)replicationInstance.State;
  // Exit and rollback one if the replication was aborted with an error
  if (state == 4)
    {
      replicationProject.Cancel();
      replicationProject.Rollback(1);
    }

See Also

Other Resources

Projects

How to Start and Stop Project Replication

CReplicationProject.GetProjectStatus Method

CReplicationInstance.State Property

CReplicationProject.Start Method

How to Rollback a Web Content Project

CReplicationProject Class