MailItem.DownloadState Property

Outlook Developer Reference

Returns a constant that belongs to the OlDownloadState enumeration indicating the download state of the item. Read-only.

Syntax

expression.DownloadState

expression   A variable that represents a MailItem object.

Example

The following Microsoft Visual Basic/Visual Basic for Applications (VBA) example searches through the user's Inbox for items that have not yet been fully downloaded. If any not yet fully downloaded items are found, a message is displayed to the user, and the item is marked for download.

Visual Basic for Applications
  Sub DownloadItems()
    Dim mpfInbox As Outlook.Folder
    Dim objItems As Outlook.Items
    Dim obj As Object
    Dim i As Integer
    Dim iCount As Integer
Set mpfInbox = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
Set objItems = mpfInbox.Items
iCount = objItems.Count
'Loop all items in the Inbox folder
For i = 1 To iCount
    Set obj = objItems.Item(i)
    'Verify if the state of the item is olHeaderOnly
    If obj.<strong class="bterm">DownloadState</strong> = olHeaderOnly Then
        MsgBox "This item has not been fully downloaded."
        'Mark the item to be downloaded
        obj.MarkForDownload = olMarkedForDownload
        obj.Save
    End If
Next

End Sub

See Also