Stop Method

As it applies to the SyncObject object

Immediately ends synchronizing a user's folders using the specified Send\Receive group. This method does not undo any synchronization that has already occurred.


*expression   * Required. An expression that returns the SyncObject object.

As it applies to the Search object

Immediately ends the search that is being performed currently.


*expression   * Required. An expression that returns the Search object.


This Microsoft Visual Basic/Visual Basic for Applications (VBA) example displays all the Send\Receive groups set up for the user and starts the synchronization based on the user's response. The sub routine following the one below immediately stops the synchronization.

The syc variable is declared as a public variable so it can be referenced by both the sub routines.

Public syc As Outlook.SyncObject

Public Sub Sync()
    Dim nsp As Outlook.NameSpace
    Dim sycs As Outlook.SyncObjects
    Dim i As Integer
    Dim strPrompt As Integer
    Set nsp = Application.GetNamespace("MAPI")
    Set sycs = nsp.SyncObjects
    For i = 1 To sycs.Count
        Set syc = sycs.Item(i)
        strPrompt = MsgBox("Do you wish to synchronize " & syc.Name &"?", vbYesNo)
        If strPrompt = vbYes Then
        End If
End Sub

Private Sub StopSync()
    MsgBox "Synchronization stopped by the user."
End Sub

Applies to | Search Object | SyncObject Object

See Also | OnError Event | Progress Event | Start Property | SyncEnd Event | SyncObjects Object