Solved

Iterate thru Outlook Contact properties

Posted on 2011-09-26
2
350 Views
Last Modified: 2012-05-12
How do I Iterate thru Outlook Contact properties. The following code works:

            Dim oApp As Outlook.Application = New Outlook.Application()
            Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi")
            oNS.Logon("Outlook", , False, True)
            Dim mainFolder As Outlook.MAPIFolder
            mainFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
            Dim subFolder As Outlook.Folder
            For Each subFolder In mainFolder.Folders
                If subFolder.Name = TextBoxFolderName.Text Then
                    Dim _Contacts As Outlook.Items = subFolder.Items
                    Dim _Contact As Outlook.ContactItem
                    For Each _Contact In _Contacts
                        Dim istr As String = _Contact.FullName
                        Dim ilb As Object = _Contact.EntryID
                        'HOW DO I ITERATE THRU ALL COLUMNS / PROPERTIES INSTEAD OF STRONGLY TYPING EACH PROPERTY?
                    Next _Contact
                End If
            Next subFolder
0
Comment
Question by:JWyrschSr
2 Comments
 
LVL 10

Accepted Solution

by:
ienaxxx earned 500 total points
ID: 36599989
Hi, you should have a look at ItemProperties collection.

Here:
http://msdn.microsoft.com/en-us/library/aa210924%28v=office.11%29.aspx


Using it you can simply have a collection of properties to iterate on.

HTH
Bye!
0
 

Author Closing Comment

by:JWyrschSr
ID: 36601897
The link referred to was for email, not contacts.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many people use more than one email account and so it becomes difficult for them to manage them when they use separate accounts,  so, in this article, I have shared an easy way to add Other Mail Accounts in your Google Inbox. It helps to combine all…
In this step by step procedure, you will come to know the details of creating an Outlook meeting in 2007, 2010, 2013 & 2016.
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now