CReplicationClient.Abort Method

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Cancels any pending Commerce Server Staging (CSS) transactions on the destination servers during the current connection.

Note

This method and the CReplicationClient object are used only to stage individual files. You cannot use this method to stage projects.

void Abort()

Remarks

You must have CSS administrator or operator rights on the project to execute this method.

Use the Abort method to interrupt a replication session that you started by using a CReplicationClient method. For example, you can use Abort to interrupt a session where you call the Connect method to initiate the session, perform replications with either the SendFile or the DeleteFile method, or sever the connection with the Disconnect method.

The Abort method has no effect if the CSS server is running in "connectionless" mode, that is, if you are making individual SendFile and DeleteFile method calls that transparently perform the connect and disconnect operations.

This method sets the State property of the CReplicationInstance object to REPL_STATE_ABORTED.

The CReplicationClient.Abort method corresponds to the COM method named ReplicationClient.Abort.

Example

The following example connects to the destination servers, deletes a file, and then sends a file. It cancels any pending operations and exits on failure.

CReplicationClient replicationClient = new CReplicationClient();
  replicationClient.Initialize("Project1");
  /*
  You can create your own replication scheme by: 
    1. Getting a list of ReplicationItem objects that have the ReplicationProject.EnumItemsEnumItems method. 
    2. Iterating through the list, replicating files
       (Item objects whose Attribute property does not have the Directory bit set).
  The following code skips these preliminary steps.
  */
  try
  {
      replicationClient.DeleteFile("oldfile.htm");
      replicationClient.SendFile("newfile.htm");
  }
  catch (System.Runtime.InteropServices.COMException)
  {
      replicationClient.Abort();
  }

See Also

Other Resources

CReplicationClient.Commit Method

CReplicationClient Class