troubleshooting Question

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

Avatar of dwe0608
dwe0608Flag for Australia asked on
Visual Basic.NETOutlook
5 Comments1 Solution454 ViewsLast Modified:
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.
        Try
            If TypeOf (mailItem) Is Outlook.MailItem Then
                Conversation = mailItem.GetConversation
                If Not IsNothing(Conversation) Then
                    Items = Conversation.GetChildren(mailItem)
                    GetConv = Items.Count
                End If
            Else
                GetConv = 0
            End If

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

    End Function

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

MTIA

DWE
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros