RE: CDO problems with synchronous store event sink
From: Toby Worth (tworth_at_avtron.com)
Date: 05/04/04
- Next message: Howard Mudge: "Outlook Web access - - blank emails received outside of Domain"
- Previous message: BP: "Re: OWA vanish"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 4 May 2004 07:11:02 -0700
hello,
try this...
if (SUCCEEDED(pdsrc->OpenObject(prec , "_Record"))) {
Thanks,
Toby
----- Caldwell Jones wrote: -----
[ Setup: Exchange 2003 on Windows Server 2003 (ADO 2.8),
Outlook 2000 on Windows XP]
I'm trying to get a handle on store event sinks.
I've written a simple sink in C++ based on
http://support.microsoft.com/default.aspx?scid=kb;EN-US;288156 and
built it using Visual C++ .NET 2003. I've used regsvr32 to register
the DLL and created a COM+ application to hold it. And I've
registered the handler for sync events at the root of my mailbox.
The good news is, events fire. My OnSyncSave method gets called and
everything generally seems pretty reasonable (though hard deletes seem
to get reported as soft deletes in lFlags). I can assign pEventInfo
to a IExStoreDispEventInfoPtr and thus get the user GUID, etc. I can
cross the EXOLEDB-to-ADO border and get the _RecordPtr using
get_EventRecord, and I can access all the Fields on the _Record
object.
But when I try to get the new message's contents, things break down.
First, I tried to get the _Record's Stream:
/* already have "_RecordPtr prec" from get_EventRecord */
_StreamPtr pstm(__uuidof(Stream));
pstm->put_Type(adTypeText);
IDispatchPtr pdispatch = NULL;
if (SUCCEEDED(prec->QueryInterface(IID_IDispatch, (void **)
&pdispatch))) {
if (SUCCEEDED(pstm->Open(_variant_t(pdispatch.GetInterfacePtr()),
adModeRead, adOpenStreamFromRecord,
L"", L""))) {
...
(I'm trying to be as cautious as possible here by making few
assumptions about the _com_ptr_t smart pointers.) Unfortunately, the
Stream Open throws an exception with code 0x800a0cb3, source
ADODB.Stream, and description "Object or provider is not capable of
performing requested operation".
So instead I decided to create a Message object from the _Record:
/* already have "_RecordPtr prec" from get_EventRecord */
IMessagePtr pmsg(__uuidof(Message));
IDataSourcePtr pdsrc = pmsg;
if (SUCCEEDED(pdsrc->OpenObject(prec.GetInterfacePtr(),
cdoAdoRecord))) {
...
Unfortunately, the IDataSource OpenObject throws an exception with
source CDO.Message.1 and description "No such interface supported".
What am I doing wrong here? From the documentation, it seems like
both of these should work. Is there an alternative way to get the
body of newly-created objects in the store?
- Next message: Howard Mudge: "Outlook Web access - - blank emails received outside of Domain"
- Previous message: BP: "Re: OWA vanish"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|