Avatar of dwe0608
Flag for Australia

asked on 

vb.net - Outlook - Counting the number of items in a conversation

Merry Christmas guys ...

I am implementing a function will will return the number of items in an Outlook Conversation - I have cobbled the following together and whilst no error is thrown - it doesnt seem to return the correct count:

    Function GetConv(mailItem As Outlook.MailItem)
        Dim Conversation As Outlook.Conversation ' Get the conversation
        Dim Items As Outlook.SimpleItems
        Dim expMessage$

        '   // If Item = a MailItem.
            If TypeOf (mailItem) Is Outlook.MailItem Then
                Conversation = mailItem.GetConversation
                If Not IsNothing(Conversation) Then
                    Items = Conversation.GetChildren(mailItem)
                    GetConv = Items.Count
                End If
                GetConv = 0
            End If

        Catch ex As SystemException
            expMessage = ex.Message
            GetConv = 0
        End Try

    End Function

Open in new window

Can someone assist to ensure that the correct count of the items in the conversation are returned?


Visual Basic.NETOutlook

Avatar of undefined
Last Comment

8/22/2022 - Mon