Solved

Iterate thru Outlook Contact properties

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Sometimes Outlook might have problems sending a message. There may be various causes- corrupted PST, AV scanner etc. The message, instead of going to the Sent Items folder, sits in the Outbox indefinitely. To remove it you can use a free tool cal…
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

911 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

25 Experts available now in Live!

Get 1:1 Help Now