Become a Columnist Microsoft Exchange Site Microsoft Support SiteMSDN Exchange Site



If you want your app to point to a specific contact list you need to use one of the following:

ns.GetDefaultFolder olFolderContacts ' will get your default contact folder

ns.GetSharedDefaultFolder x, olFolderContacts ' will get someone elses default contact folder, assume they are sharing it

ns.GetFolderFromID EntryID, StoreID ' assuming you have entryid & storeid saved will get a specific folder, you would normally have a lookup routine go out & find these, with either a select dialog box, or matching on name, then save the info from the found items...

' Use a loop like below to find a folder with a specific name, description, or MessageClass, once found you could save the entryid & storeid for later use

Attached is a couple of Word VBA functions that will walk the MAPI folder tree in Outlook. What you find is off of the NameSpace object you will have your information stores, I have two, the 'Microsoft Mail' shared folders, and my 'Personal Information Store', then under each information store (or message store) you will have your folders, then under those folders, you may have more folders...

Sub ListFolders()
Dim app As New Outlook.Application
Dim ns As NameSpace
Set ns = app.GetNamespace("MAPI")
Debug.Print ns.CurrentUser.Name
ListFolder ns.Folders, 0
End Sub

Sub ListFolder(parent As Folders, depth As Integer)
Dim flr As MAPIFolder
Dim s As String
s = String(depth * 2, " ")
For Each flr In parent
Debug.Print s; flr.Name; ": "; flr.DefaultMessageClass
ListFolder flr.Folders, depth + 1
Next flr
End Sub

Here is what my MAPI folder tree looks like, NOTE this does not include

Exchange Server...

Jay B. Harlow

Microsoft Mail Shared Folders IPM.Note
Shared Folder IPM.Note
Personal Information Store
Deleted Items IPM.Note
Inbox IPM.Note
Outbox IPM.Note
Sent Items IPM.Note
The Microsoft Network IPM.Note
Personal IPM.Note
Schedule+ IPM.Note
Calendar IPM.Appointment
Contacts IPM.Contact
Journal IPM.Activity
Notes IPM.StickyNote
Tasks IPM.Task

Hope this helps


Disclaimer: Your use of the information contained in these pages is at your sole risk. All information on these pages is provided "as is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by Stephen Bryant or Pro Exchange. OutlookExchange.Com, Stephen Bryant and Pro Exchange shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.

Copyright Stephen Bryant 2008