How to search all Outlook public folder contacts from a Word macro?

M

Michael Mercer

With the code shown below I can get, from Word, the
user's default Outlook contacts folder, and then a
specific subfolder beneath that, to search for a contact.

Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder
(olFolderContacts)
Set myNewFolder = myFolder.Folders("TBW")
strFind = "[FileAs] = " + strContactName
Set myItem = myNewFolder.Items.Find(strFind)

But what is the code to search a Public (shared) Folder,
or better yet, to search ALL contacts in all folders,
public and otherwise?

Thanks,

--Michael
 
M

Milly Staples [MVP - Outlook]

You can only search one store at a time. Either the mailbox or public
folders. Additionally, you cannot search more than one public folder at a
time.

--
Milly Staples [MVP - Outlook]

Post all replies to the group to keep the discussion intact. Due to the
Swen virus, all e-mails sent to my actual account will be deleted w/out
reading.

After searching google.groups.com and finding no answer
Michael Mercer <[email protected]> asked:

| With the code shown below I can get, from Word, the
| user's default Outlook contacts folder, and then a
| specific subfolder beneath that, to search for a contact.
|
| Set myOlApp = CreateObject("Outlook.Application")
| Set myNameSpace = myOlApp.GetNamespace("MAPI")
| Set myFolder = myNameSpace.GetDefaultFolder
| (olFolderContacts)
| Set myNewFolder = myFolder.Folders("TBW")
| strFind = "[FileAs] = " + strContactName
| Set myItem = myNewFolder.Items.Find(strFind)
|
| But what is the code to search a Public (shared) Folder,
| or better yet, to search ALL contacts in all folders,
| public and otherwise?
|
| Thanks,
|
| --Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top