全部显示

DownloadState 属性

       

返回或设置项目的下载状态。OlDownloadState 常量,只读。

expression.DownloadState

expression  必选。该表达式返回“应用于”列表中的一个对象。

示例

以下示例在用户的“收件箱”中搜索尚未下载的项目。如果找到了任何此类项目,就向用户显示一条消息,并将该项目标记为下载。

Public Sub DownloadStateTest()
'Tests items in the user's Inbox

    Dim outApp As Outlook.Application
    Dim mpfInbox As Outlook.MAPIFolder
    Dim obj As Object

    Set outApp = CreateObject("Outlook.Application")
    Set mpfInbox = outApp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)

    ' Loop all items in the Inbox Folder
    For i = 1 To mpfInbox.Items.Count
        Set obj = mpfInbox.Items.Item(i)
        'Verify if the state of the item is olHeaderOnly
        If obj.DownloadState = olHeaderOnly Then
            MsgBox ("This item has not been fully downloaded")
            'Mark the item to be downloaded
            obj.MarkForDownload = olMarkedForDownload
        End If
    Next

End Sub