Home All Groups Group Topic Archive Search About

Ex2003 PF Async Event Sink OnDelete fires OnSave doesn't

Author
2 Feb 2009 10:55 PM
Jason Gurtz

I can't seem to find any pointers anywhere on how to debug why one
method would work fine and the other not in a managed code store event
sink registered to a mail enabled public folder.

Right now I have in my sink just debugging code which writes to a txt
file and the event log when the method fires.  Everything looks fine,
including the registration in the SystemMailbox{GUID} as viewed in
MFCMAPI utility.

There are no errors happening anywhere that I can see.  I delete a
message in the folder and I get an event log entry.  A message gets
delivered or I copy a message to the folder and nothing happens.  Bizarre...

Will someone please advise on where to turn up logging or maybe pointers
to using windbg on COM+ managed code interfaces to see where the failure
is?  Any help gratefully received.

~JasonG

--

An example log entry from my OnDelete code looks like this:

OnDelete Fired at 02/02/09 10:33:54
Script fired by file://./backofficestorage/npumail.com/Public
Folders/zTest CBYD/Testing.EML

Here are snippets from the top of each method:

public void OnSave(IExStoreEventInfo pEventInfo,
                   string bstrURLItem, int lFlags)
{
    try {
        //Debugging
        System.Diagnostics.EventLog EvtLog1 = new
            System.Diagnostics.EventLog();

        if (!System.Diagnostics.EventLog.SourceExists("EvtSink_CBYD")) {
            System.Diagnostics.EventLog.CreateEventSource(
                "EvtSink_CBYD", "Application");
        }
        EvtLog1.Source = "EvtSink_CBYD";
        EvtLog1.WriteEntry("OnSave Fired");

        StreamWriter logFile = new StreamWriter(
            @"c:\tmp\EventSink\run.log", true);
        logFile.AutoFlush = true;
        logFile.Write("OnSave Fired at " + System.DateTime.Now + "\n");
        logFile.Write("Script fired by " + bstrURLItem + "\n");
        logFile.Close(); logFile.Dispose();

        // ... Omitted ...
}

public void OnDelete(IExStoreEventInfo pEventInfo,
                     string bstrURLItem, int lFlags)
{
    try {
        //Debugging
        System.Diagnostics.EventLog EvtLog1 = new
            System.Diagnostics.EventLog();

        if (!System.Diagnostics.EventLog.SourceExists("EvtSink_CBYD")) {
            System.Diagnostics.EventLog.CreateEventSource(
                "EvtSink_CBYD", "Application");
        }
        EvtLog1.Source = "EvtSink_CBYD";
        EvtLog1.WriteEntry("OnDelete Fired");

        StreamWriter logFile = new StreamWriter(
            @"c:\tmp\EventSink\run.log", true);

        logFile.AutoFlush = true;
        logFile.Write("OnDelete Fired at " + System.DateTime.Now +
            "\n");

        logFile.Write("Script fired by " + bstrURLItem + "\n");
        logFile.Close(); logFile.Dispose();

        // ... Omitted ...
}
Author
3 Feb 2009 8:59 AM
Massimiliano Piccinini
On 2 Feb, 23:55, Jason Gurtz <jasonNOgu...@npuSPAMmail.com> wrote:
Show quoteHide quote
> I can't seem to find any pointers anywhere on how to debug why one
> method would work fine and the other not in a managed code store event
> sink registered to a mail enabled public folder.
>
> Right now I have in my sink just debugging code which writes to a txt
> file and the event log when the method fires.  Everything looks fine,
> including the registration in the SystemMailbox{GUID} as viewed in
> MFCMAPI utility.
>
> There are no errors happening anywhere that I can see.  I delete a
> message in the folder and I get an event log entry.  A message gets
> delivered or I copy a message to the folder and nothing happens.  Bizarre...
>
> Will someone please advise on where to turn up logging or maybe pointers
> to using windbg on COM+ managed code interfaces to see where the failure
> is?  Any help gratefully received.
>
> ~JasonG
>
> --
>
> An example log entry from my OnDelete code looks like this:
>
> OnDelete Fired at 02/02/09 10:33:54
> Script fired by file://./backofficestorage/npumail.com/Public
> Folders/zTest CBYD/Testing.EML
>
> Here are snippets from the top of each method:
>
> public void OnSave(IExStoreEventInfo pEventInfo,
>                    string bstrURLItem, int lFlags)
> {
>     try {
>         //Debugging
>         System.Diagnostics.EventLog EvtLog1 = new
>             System.Diagnostics.EventLog();
>
>         if (!System.Diagnostics.EventLog.SourceExists("EvtSink_CBYD")) {
>             System.Diagnostics.EventLog.CreateEventSource(
>                 "EvtSink_CBYD", "Application");
>         }
>         EvtLog1.Source = "EvtSink_CBYD";
>         EvtLog1.WriteEntry("OnSave Fired");
>
>         StreamWriter logFile = new StreamWriter(
>             @"c:\tmp\EventSink\run.log", true);
>         logFile.AutoFlush = true;
>         logFile.Write("OnSave Fired at " + System.DateTime.Now + "\n");
>         logFile.Write("Script fired by " + bstrURLItem + "\n");
>         logFile.Close(); logFile.Dispose();
>
>         // ... Omitted ...
>
> }
>
> public void OnDelete(IExStoreEventInfo pEventInfo,
>                      string bstrURLItem, int lFlags)
> {
>     try {
>         //Debugging
>         System.Diagnostics.EventLog EvtLog1 = new
>             System.Diagnostics.EventLog();
>
>         if (!System.Diagnostics.EventLog.SourceExists("EvtSink_CBYD")) {
>             System.Diagnostics.EventLog.CreateEventSource(
>                 "EvtSink_CBYD", "Application");
>         }
>         EvtLog1.Source = "EvtSink_CBYD";
>         EvtLog1.WriteEntry("OnDelete Fired");
>
>         StreamWriter logFile = new StreamWriter(
>             @"c:\tmp\EventSink\run.log", true);
>
>         logFile.AutoFlush = true;
>         logFile.Write("OnDelete Fired at " + System.DateTime.Now +
>             "\n");
>
>         logFile.Write("Script fired by " + bstrURLItem + "\n");
>         logFile.Close(); logFile.Dispose();
>
>         // ... Omitted ...
>
> }

Hi,
have you tryed to instantiate the object from vbscript or javascript ?
For istance :

var ooo
set ooo = CreateObject("MyObject.MyClass")

ooo.OnSave Nothing , "URL", 0
set ooo = Nothing

................

Doing this way you'll see if the object/method itself is working in
the right way.
Please, tell me if your pEventInfo is correcly populated in OnDelete
().

Bye
Are all your drivers up to date? click for free checkup

Author
3 Feb 2009 2:34 PM
Jason Gurtz
Massimiliano Piccinini wrote:
[...]
> Hi,
> have you tryed to instantiate the object from vbscript or javascript ?
> For istance :

Thank you for your response Massimiliano.  This test has led me to the
solution to my problem (a really nice gotcha!).  I found the test a
missing reference on the exchange machine:  there was no
%programfiles%\Microsoft.NET\Primary Interop Assemblies which has in it
on my development machine adodb.dll version 7.10.3077.0

If one googles for "adodb.dll pia missing" it is a common problem with
no great answer.  I installed the latest office 2007 Primary Interop
Assemblies redistributable on the server, but it installs an older
version of adodb.dll (strangely a year newer than the actual later
version installed by VS.2005).

I found the best solution without making dll hell even more polluted was
to delete the present adodb ref from the .NET tab and make a new ref
from browse to a copy that sits right in the project's \bin

I hope microsoft will update the office pia redist or create a separate
ADO.Net pia redist.  I REALLY hope they update their building managed
event sink dlls msdn entry to mention adodb.dll ref (I found the article
code example will not build as is in VS.2005) and also the real need to
build a deployment package to manage this reference since the framework
does not install this.

Thanks,

~JasonG

--

Bookmark and Share