Solved

Iterate thru Outlook Contact properties

Posted on 2011-09-26
2
348 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Set OWA language and time zone in Exchange for individuals, all users or per database.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

759 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

20 Experts available now in Live!

Get 1:1 Help Now