问题
I want to add support for searching for local Outlook contacts to my ATL/WTL app. Does anyone know of the Outlook COM interface (Office 2003 or greater) allows you to search for contacts? I already have LDAP lookup support but users want to be able to search their private contacts as well.
Any information would be welcome.
回答1:
To get access to the contacts you first have to get a Namespace object using the Application's GetNamespace function, passing "MAPI" as the namespace name.
Then you use Namespace's GetDefaultFolder function, which gives you a MAPIFolder interface which contains an Items property.
Next you call the Find function on the items.
回答2:
You must use MAPI to get access
Here you can find a MAPI wrapper
http://www.codeproject.com/KB/IP/CMapiEx.aspx
Also you should use Outlookspy, its very useful Add-on to show you most of MAPI interfaces and Outlook Object Model
You should read more about MAPI functions from MSDN
http://msdn.microsoft.com/en-us/library/aa142548(EXCHG.65).aspx
来源:https://stackoverflow.com/questions/811974/search-outlook-contact-using-com