InAppFolderSyncObject Property

Microsoft Outlook Visual Basic

is synchronized. If False, the folder will not synchronize. Read/write.

expression.InAppFolderSyncObject

expression    Required. An expression that returns a MAPIFolder object.

Remarks

This is equivalent to selecting the check box for this folder in the Application Folders group on the Send/Receive dialog box.

If this property is set to True, and the "Application Folders" SyncObject does not already exist, a SyncObject will be automatically created. The "Application Folders" SyncObject is the only Send/Receive group that can be programmatically modified.

Example

The following Microsoft Visual Basic/Visual Basic for Applications (VBA) example sets the Inbox folder to be synchronized when the "Application Folders" SyncObject object is synchronized. The InAppFolderSyncObject property is used in conjunction with the AppFolders property of the SyncObjects collection.

Public Sub appfolders()
    Dim olApp As New Outlook.Application
    Dim nsp As Outlook.NameSpace
    Dim sycs As Outlook.SyncObjects
    Dim syc As Outlook.SyncObject
    Dim mpfInbox As Outlook.MAPIFolder

    Set nsp = olApp.GetNamespace("MAPI")

    Set sycs = nsp.SyncObjects

    'Return the Application Folder SyncObject.
    Set syc = sycs.AppFolders

    'Get the Inbox folder.
    Set mpfInbox = nsp.GetDefaultFolder(olFolderInbox)
    'Set the Inbox folder to be synchronized when the Application
    'Folder's SyncObject is synchronized.
    mpfInbox.InAppFolderSyncObject = True

    'Start the synchronization.
    syc.Start

End Sub