2 Quick Methods to Count the Appointments Linked to an Outlook Contact

If you would like to get the number of the appointments that are linked to a specific contact, you can use either of the 2 means introduced in this article.

Outlook allows users to link appointments to contacts. If you have linked many appointments to a specific contact and later want to count them, you must dislike counting them one by one. Therefore, in the followings, we will introduce 2 ways to you. You can choose ether to your liking.

Method 1: Count in Contact “Activities”

  1. At first, double click the specific contact to open it in its own window.
  2. Then, click the “Activities” in the “Show” group.Click "Activities"
  3. Next, in the new page, move cursor to header of the activity list.
  4. Subsequently, right click and choose “View Settings” from the context menu.Access "View Settings"
  5. Afterwards, in the popup dialog box, click “Group By” button.
  6. Later, in another dialog, select “Message Class” in the “Group items by” drop down list.Group items by "Message Class"
  7. Ultimately, click a series of “OK” to apply the view settings.
  8. When you return to the list, you can see a group called “IPM.Appointment” with a total count of all the appointments linked to the current macro, shown as the following screenshot.Get Count of Linked Appointments in Group Header

Method 2: Count with Outlook VBA

  1. To begin with, access Outlook VBA editor via “Alt + F11”.
  2. Then, copy the following VBA code into a module.
Dim objContact As ContactItem

Sub CountAppointmentsLinkedToContact()
    Dim objStore As Store
    Dim objOutlookFile As Folder
    Dim lTotalCount As Long
    'Get the contact
    Set objContact = Outlook.Application.ActiveExplorer.Selection.Item(1)
    lTotalCount = 0
    For Each objStore In Application.Session.Stores
        Set objOutlookFile = objStore.GetRootFolder
        Call ProcessFolders(objOutlookFile.Folders, lTotalCount)
    'Prompt you
    If lTotalCount > 0 Then
       MsgBox lTotalCount & " appointments are linked to " & objContact.FullName & ".", vbInformation + vbOKOnly
       MsgBox "No appointment is linked to " & objContact.FullName & ".", vbExclamation + vbOKOnly
    End If
End Sub

Sub ProcessFolders(ByVal objFolders As Folders, lCount As Long)
    Dim objFolder As Folder
    Dim objItem As Object
    'Process all folders recursively
    For Each objFolder In objFolders
        For Each objItem In objFolder.Items
            If TypeOf objItem Is AppointmentItem Then
               If objItem.Links.Count > 0 Then
                  i = 0
                  Do Until i = objItem.Links.Count
                     i = i + 1
                     If objItem.Links(i).Name = objContact.FullName Then
                        lCount = lCount + 1
                        Exit Do
                     End If
               End If
            End If
        If objFolder.Folders.Count > 0 Then
           Call ProcessFolders(objFolder.Folders, lCount)
        End If
End Sub

VBA Code - Count the Appointments Linked to a Contact

  1. Later, add this macro to Quick Access Toolbar (QAT) by following the steps in “How to Run VBA Code in Your Outlook“.
  2. Finally, you can try it.
  • First off, select a contact.
  • Then, hit the macro button in QAT.
  • When macro finishes, you will receive a message about the count of appointments linked to the selected contact, like the picture below.Prompt about the Count

When Encountering Frequent Outlook Issues

Assuming that you always come across a variety of problems in your Outlook, you should raise your vigilance. It is very likely that your Outlook PST file tends to be corrupted. At this point, you’d make an updated backup of your Outlook data file at once. Also, if possible, it is recommended to get hold of a powerful PST repair tool, such as DataNumen Outlook Repair.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including recover sql and outlook repair software products. For more information visit www.datanumen.com

Leave a Reply

Your email address will not be published. Required fields are marked *