RE: CDO problems with synchronous store event sink

From: Toby Worth (tworth_at_avtron.com)
Date: 05/04/04


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?
     



Relevant Pages

  • Re: Tomcat - Internal Server Error 500
    ... The root cause is NoClassDefFoundError (shown ... internal error 500. ... error, upon pressing submit. ... It shows the following exception: ...
    (comp.lang.java.help)
  • Re: Java and buffer overflows
    ... What happened here is that the JavaVM caught an exception while parsing ... > passed user input to a buffer but the compiler kept barking at me so ... > [root@rcmqa5 root]# javac test.java ...
    (Vuln-Dev)
  • Re: "False exceptions?" (was Re: theme of the week: tools
    ... a debugger can be useless because it affects the scheduling ... My point was that even just this particular exception ... Even if there is an exception, the root problem may be way ... from prior memory corruption) quickly end up in some state where you ...
    (comp.lang.python)
  • Re: (Linux) GNAT socket exception - when setting No_Delay
    ... You didn't say what exception you're getting. ... the TCP/IP stack. ... errno, then GNAT.Ada immediately raises the Socket_Error exception. ... and you are not root. ...
    (comp.lang.ada)
  • imaplib : error reporting use randomly exception or return value
    ... For example, when trying to append into a mailbox with wrong ACL, ... imaplib return 'NO', but dont raise any exception (I give a sample at ...
    (comp.lang.python)