Retrieving information on Outlook VB Object int C++

S

Semut

In VB codes,

Dim objItem As Object <----declare objItem as Object.
Dim objNS As NameSpace

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objItem = objApp.ActiveInspector.CurrentItem
If objItem.Class = olContact Then <---- can easily determine it's type.
....


But how to call this in C++? What are the equivalent of Object class in C++?

For instance, I obtain the Outlook::Items collection from the
Outlook::Folder, then, For each of the item in the Outlook::Items
colelction, it will return me a IDispatch. What are the function or
utilities for me to determine the type of the item it returns? I can use
IDispatch and place it into ContactItem, TaskItem or MailItem. But does
Outlook has a primitive object type like VB Object class so that I could
check if the item is of which item type. I know VB has it, but how about
C++?


thank you
 
D

Dmitry Streblechenko \(MVP\)

Object is IDispatch in C++. VB takes care of calling
IDispatch::GetIDsOfNames and IDispatch::Invoke when you declare an object as
a generic Object, you need to do that explicitly in C++.
Each Outlook object has a Class property (==43 for MailItem). Or you can
call IDispatch::QueryInterface() andf see if the call fails.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

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