DownloadState Property

Microsoft Outlook Visual Basic

Show All

DownloadState Property

       

Returns or sets an OlDownloadState constant indicating the download state of the item. Read-only OlDownloadState.

OlDownloadState can be one of these OlDownloadState constants.
olFullItem The entire item has been downloaded.
olHeaderOnly Only the header has been downloaded.

expression.DownloadState

expression   Required. An expression that returns one of the objects in the Applies To list.

Example

The following example searches through the user's Inbox for items that have not yet been downloaded. If any such items are found, a message is displayed to the user and the item is marked for download.

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