TaskItem.Links Property

Outlook Developer Reference

Returns a Links collection that represents the contacts to which the item is linked. Read-only.

Syntax

expression.Links

expression   A variable that represents a TaskItem object.

Example

This Microsoft Visual Basic/Visual Basic for Applications (VBA) example steps through the items in the Tasks folder and, if a task is not complete, displays the number of contacts linked to the item.

Visual Basic for Applications
  Sub CountLinks()
    Dim myNSpace As Outlook.NameSpace
    Dim myItems As Outlook.Items
    Dim myItem As Outlook.TaskItem
    Dim myLinks As Outlook.Links
    Dim myLink As Outlook.Link
    Dim x As Integer
    Dim msg As String
Set myNSpace = Application.GetNamespace("MAPI")
Set myItems = myNSpace.GetDefaultFolder(olFolderTasks).Items
For x = 1 To myItems.Count
    If TypeName(myItems.Item(x)) = "TaskItem" Then
        Set myItem = myItems.Item(x)
        Set myLinks = myItem.<strong class="bterm">Links</strong>
        Msg = myItem.Subject &amp; " has " &amp; myLinks.Count &amp; " links."
        If myItem.Complete = False Then
            If MsgBox(Msg, vbOKCancel) = vbCancel Then Exit For
        End If
    End If
 Next x

End Sub

See Also