Hi!
Need Access to OutlookContacts from VB?
In Public folders??
Any ideas?
Printable View
Hi!
Need Access to OutlookContacts from VB?
In Public folders??
Any ideas?
You can do things like:
set OL = GetObject(,"OUTLOOK.APPLICATION")
set MAPI = OL.GetNamespace("MAPI")
Set myItems = MAPI.GetDefaultFolder(10).Items
where the default folder number 10 is Contacts (Or call it olFolderContacts).
Ot you can select folders and move down the levels if you need to look into the Public Folders area. Something like (although this is a .VBS script file):
VB Code:
Set WshShell = WScript.CreateObject("WScript.Shell") set OL = GetObject(,"OUTLOOK.APPLICATION") set myMAPI = OL.GetNamespace("MAPI") Set myStore = myMAPI.Folders("Public Folders") Set myItems = myStore.Folders("Company Contacts") MsgBox "Looking at " & myItems.Items.Count & " items"
There are also Outlook Objects you can reference in your project. They're really easy to work with, although there's some technique you need defining namespaces.
Here's an MSDN article with some sample code:
http://support.microsoft.com/default...b;en-us;220595