How to get AppointmentItem from a SetColumns table row?


P

Peter Kron

I am using Items.SetColumns to speed up retrieval of a calendar from C++
(Outlook9 object model). Once I locate an interesting row, I want to get the
corresponding AppointmentItem and dig deeper. The problem is that the object
returned for the row will not QueryInterface to an _AppointmentItem
interface.


CComBSTR columns = "LastModificationTime";

result = items->SetColumns( columns);

CComPtr<IDispatch> item;

CComVariant index(1);

result = items->Item( index, &item);

CComQIPtr<_AppointmentItem> appointment = item;

// appointment is NULL due to E_NOINTERFACE



The Item method returns IDispatch and I can access properties with
IDispatch::Invoke, so I thought I could get the EntryID and open the item
from that. However, that particular property returns 0x6543 as an error.
What is that?

::DISPPARAMS params;

params.rgvarg = NULL;

params.rgdispidNamedArgs = NULL;

params.cArgs = 0;

params.cNamedArgs = 0;

CComVariant property;

DISPID dispId = 0x3008; // LastModificationTime

result = item->Invoke( dispId, IID_NULL, (LCID)0, DISPATCH_PROPERTYGET,
&params, &property, NULL, NULL);

// Retrieve LastModificationTime column

dispId = 0x37; // Subject

result = item->Invoke( dispId, IID_NULL, (LCID)0, DISPATCH_PROPERTYGET,
&params, &property, NULL, NULL);

// Subject was not a column but can still get it

EXCEPINFO info;

dispId = 0xf01e; // EntryID

result = item->Invoke( dispId, IID_NULL, (LCID)0, DISPATCH_PROPERTYGET,
&params, &property, &info, NULL);

// Why does this return result = 0x6543??


Thanks for shedding any light on this
Peter
 
Ad

Advertisements


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