InAppFolderSyncObject Property

Microsoft Outlook Visual Basic

InAppFolderSyncObject Property

       

Returns or sets a Boolean that determines if the specified folder will be synchronized with the mail server. If True, this folder will be synchronized when the "application folders" SyncObject 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 clicking the check box for this folder in the "application folders" group of 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.

Example

The following example sets the current MAPIFolder to synchronize when the "Application Folders" SyncObject object is synchronized. Here, the InAppFolderSyncObject property is used in conjunction with the AppFolders property of the SyncObject.

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

    'Star the synchronization
    syc.Start

End Sub