Abort Method

This method cancels any pending transactions on the destination servers during the current connection.

Syntax

ReplicationClient.Abort

Remarks

Use this method to interrupt any replication session (a session where you call the Connect method to initiate the session, perform replications with either the SendFile method or the DeleteFile method, and sever the connection with the Disconnect method). This method has no effect if the Content Deployment server is running in “connectionless” mode (you are issuing individual SendFile and DeleteFile method calls where they transparently perform the connect and disconnect operations).

This method sets ReplicationInstance.State property to REPL_STATE_ABORTED.

Example

The following example connects to the destination servers and deletes a file. If the deletion fails, it cancels any pending operations and exits.

Option Explicit 
On Error Resume Next

dim ReplClient
set ReplClient = CreateObject("CrsApi.ReplicationClient")
ReplClient.Initialize("Project1")

'You can roll your own replication scheme by: 
'1. Getting a list of ReplicationItem objects with the 
' ReplicationProject.EnumItemsEnumItems method. 
'2. Iterate through the list, replicating files
' (Item objects whose Attribute property does not have the
'  Directory bit set).
'The following code skips these preliminary steps.

do while True
  Err.Clear
  ReplClient.Connect
  if Err.Number > 0 then
    Wscript.Echo "Error connecting to destination servers."
    exit do
  end if

  ReplClient.DeleteFile("oldfile.htm")
  if Err.Number > 0 then
    Wscript.Echo "Error deleting oldfile.htm"
    ReplClient.Abort
    exit do
  end if
 
  ReplClient.SendFile("newfile.htm")
  if Err.Number > 0 then
    Wscript.Echo "Error sending newfile.htm"
    ReplClient.Abort
    exit do
  end if

  'Normally you would be checking for CRS_ERROR_NO_MORE_ITEMS
  exit do
loop
'Release Client object
set ReplClient = Nothing

See Also

ReplicationClient.Commit


© 1997-1998 Microsoft Corporation. All rights reserved.