Progress Event

Microsoft Outlook Visual Basic

Progress Event

       

Occurs periodically while Microsoft Outlook is synchronizing a user’s folders using the specified synchronization profile. This event is not available in VBScript.

Sub object_Progress(ByVal State As OlSyncState, ByVal Description As String, ByVal Value As Long, ByVal Max As Long)

object   An expression that evaluates to a SyncObject object.

State   Required. A value that identifies the current state of the synchronization process. Can be either of the following OlSyncState constants: olSyncStarted or olSyncStopped.

Description   Required. A textual description of the current state of the synchronization process.

Value   Required. Specifies the current value of the synchronization process (such as the number of items synchronized).

Max   Required. The maximum that Value can reach. The ratio of Value to Max represents the percent complete of the synchronization process.

Example

This example updates a label on a form to show the progress of synchronization. The sample code must be placed in a class module, and the Initialize_handler routine must be called before the event procedure can be called by Microsoft Outlook.

Dim myOlApp As New Outlook.Application
Dim WithEvents mySync As Outlook.SyncObject
Dim myForm As New Form1

Sub Initialize_handler()
    Set mySync = myOlApp.Session.SyncObjects.Item(1)
End Sub

Private Sub mySync_Progress(ByVal State As Outlook.OlSyncState, ByVal Description As String, ByVal Value As Long, ByVal Max As Long)
    If State = olSyncStarted then 
        Cap = "Synchronization started: "
    Else
        Cap = "Synchronization stopped: "
    End If
    Cap = Cap & Str(State / Max * 100) & "% " & Description
    Form1.Label1.Caption = Cap
End Sub