Previous in Contents Next in Contents

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.EnumItems 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.

ReplClient.Connect

If Err.Number > 0 Then
  Wscript.Echo "Error connecting to destination servers."
  Wscript.Quit
End If

ReplClient.DeleteFile("oldfile.htm")

If Err.Number > 0 Then
  Wscript.Echo "Error deleting oldfile.htm"
  ReplClient.Abort
  Wscript.Quit
End If

ReplClient.SendFile("newfile.htm")

If Err.Number > 0 Then
  Wscript.Echo "Error sending newfile.htm"
  ReplClient.Abort
  Wscript.Quit
End If

'Release Client object
set ReplClient = Nothing

See Also

ReplicationClient.Commit


© 1997-2000 Microsoft Corporation. All rights reserved.