InAppFolderSyncObject 属性

       

返回或设置 Boolean 类型值,确定是否要同步指定文件夹与邮件服务器。如果值为 True,将会在同步“应用程序文件夹”的 SyncObject 对象时对该文件夹进行同步。如果值为 False,将不同步该文件夹。可读写。

expression.InAppFolderSyncObject

expression  必选。该表达式返回 MAPIFolder 对象。

说明

该属性等同于在“发送/接收”对话框的“应用程序文件夹”组中单击该文件夹旁的复选框。

如果该属性设置为 True,而“应用程序文件夹”的 SyncObject 对象并不存在,则会自动创建一个 SyncObject 对象。

示例

以下示例将当前的 MAPIFolder 对象设置为同步“应用程序文件夹”的 SyncObject 对象时进行同步。这里,InAppFolderSyncObject 属性与 SyncObject 对象的 AppFolders 属性联合使用。

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