How to get Categories list?

M

michaaal

How can I get my categories list? (the categories that I put my Contacts in)

Is this even close...?

Dim objApp As Application
Dim objNS As NameSpace
Dim objContacts As MAPIFolder
Dim objItem As Object

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objContacts = objNS.GetDefaultFolder(olFolderContacts)
x = set objContacts.Categories
For Each objCategories in x
msgbox(objCategories)
Next
 
M

michaaal

michaaal said:
How can I get my categories list? (the categories that I put my Contacts in)

Is this even close...?

Dim objApp As Application
Dim objNS As NameSpace
Dim objContacts As MAPIFolder
Dim objItem As Object

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objContacts = objNS.GetDefaultFolder(olFolderContacts)
x = set objContacts.Categories
For Each objCategories in x
msgbox(objCategories)
Next


Ok...so I found the categories list here in the registry...
HKCU\Software\Micdrosoft\Office\9.0\Outlook\Categories

But how to you tell if a contact belongs to a particular category???
 
K

Ken Slovak - [MVP - Outlook]

You have to read the Categories property for each contact or you can search
in the Items collection of the folder for a specific category, but you can't
use Outlook's Find or Restrict for that. They don't allow searching on
Categories. You could use a MAPITable restriction to do it but that would
require Extended MAPI (C++ or Delphi code only) or Redemption code
(www.dimastr.com/redemption).
 
S

Sue Mosher [MVP-Outlook]

You need to check the ContactItem.Categories property of each contact. It's
a keywords
field so you can break it into an array with Split() to match against some
other list that you want to check. Remember that a contact may have
categories that are not in the master list.
 
S

Sue Mosher [MVP-Outlook]

I've used Find and Restrict with Categories OK in the past. It's certainly
worth trying.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
K

Ken Slovak - [MVP - Outlook]

Another thing we need to tell MS the help isn't right about then? In the
Object Browser Help on Restrict it lists Categories as a prop that can't be
used...
 

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