How to display the ContactItems Firstname in a ListBox

40 Views Asked by At

I got a list of Outlook Contacts and want to display them in a ListBox. This is the code I use to add every Contact to the ListBox but

foreach (ContactItem contact in contactItemsList)
            {
                ListBox_contacts.Items.Add(contact);
            }

The problem I have is with the output of the ListBox. Rather than showing the FirstName of each Contact it shows only: System.__ComObject

I read some things with overriding the ToString()- method but wasn´t able to understand how I should do that.

1

There are 1 best solutions below

1
Dmitry Streblechenko On BEST ANSWER

How about just

ListBox_contacts.Items.Add(contact.Firstname);