How do I hook events happening in Lotus Notes 8.5 client from an external application?

Posted on 2009-02-23
Last Modified: 2013-12-18
A) I need to hook into events happening in the Lotus Notes 8.5 client specifically
1.      Document Open
2.      Document Close
3.      Document Print
4.      Document Save
5.      Email Send
6.      Email Receive
B) I need to recieve the event notifications mentioned in A) in an external .net program.
C) the code needs to be transparent to the user of Notes, and should be secure so that the notes user cannot "turn off" or disable these notiifications in any way or method.

From earlier questions to EE, I have worked out that I need to use the Lotus Notes v8 C API for Windows platforms.
From examination of the API, it looks like I need something like the sample program Admin\Tracker which receives notiifications of documents opening but this sample specifies a known database whereas I want to know about any note document or email that is opened.

Also the sample program Mail\ExtMail looks similar to what I want but it seems to be a Notes Extension and I am unsure of whether the Notes user would be able to turn this off or whether I could put this code in an external application.

Can anyone help me with narrowing down which method, code, sample I should be concemtrating on please?
If you have a sample program of your own that I could use, that would be even better.

P.S. I shall hopefully be wrapping the functions I need in an interop dll registered in my external program so that I can interact with the Notes application via the dll. I shall be using in the external program but C# example would be fine too or just some idea of what I need to do.

Regards in advance
Question by:jacbarker
    LVL 46

    Expert Comment

    by:Sjef Bosman
    You need the Extension Manager services built into Notes. See:
    AFAIK, there is a sample program called ExtMgr.c or so. Indeed the ExtMail might be what you need to base your application on.

    In any way, you have to create your own DLL that intercepts the events. If you want to be able to hook up any database, you'd have to intercept the DatabaseOpen event as well.

    Potential problems:
    - your DLL has to be included in the Notes client via a line in notes.ini; the user can alter this line, he has sufficient rights to modify the notes.ini file; you could add a special feature in your DLL that you call upon for instance when the mail database is opened, so you can verify the presence of the extension
    - the code will generate a lot of events if you monitor ALL databases
    - where is the other party application that will interface with the Notes client?
    - if it is on a server, what if the Notes client is disconnected?
    - and what if the client is connected via a slow link?

    Maybe you have to create your own message queue or event queue that your .NET application can attach to, in order to ensure that both applications can work independently if event handling isn't fast enough in .NET.

    Author Comment

    Do all applications (NSF hook drivers and also Extension manager applications) using the C API require an entry in Notes.ini?
    If they do then I think I'm stuffed as I require the user not be able to affect the notifications at all.
    LVL 22

    Expert Comment

    Here's an example that might help (with C++ project source code):

    I hope it'll help,
    LVL 46

    Expert Comment

    by:Sjef Bosman
    Yes, the notes.ini entry is required. But you could verify the presence of the extension by testing it using a special call, from the mail database or so.

    Just interested: what do you want to monitor that isn't yet monitored by Notes itself??

    Author Comment

    1) Does my DLL containing the Notes C API code have to reside in the notes program directory?

    2) Sjef - I've found that Notes does monitor Notes activity in logs but my external application (which will reside on the same machine as the Notes client) need notifications as they happen.

    Spec change for my app - now I do not mind if user sees the entry in Notes.ini for my application.
    LVL 46

    Expert Comment

    by:Sjef Bosman
    1) I suppose that would be the best place for it; i assume that DLLPATH is used to find the DLL but I don't know, and I can't find an example; so just try to build a sample application and place the dll elsewhere; check whether that dir is in PATH or in DLLPATH

    2) Here's a similar application:

    Watch out, your DLL will be completely swamped by events (the log database, the workspace, the cache, they are all databases...)

    Author Comment

    Using a cut down version of the tracker (database hook driver) example program (without logging to a database or doing trashcan that is included in the example) I think I can trap notifications for <NoteOpen>, <NoteUpdate>.
    This seems to cover 1) and 4) of the events I need to trap. Will it trap the others?

    If I write an extension manager, I can trap for EM_MAILSENDNOTE, EM_SMTPMESSAGEACCEPT (Will this trap when the Notes Client recieves a new email message?), EM_NSFNOTEOPEN, EM_NSFNOTECLOSE, EM_NSFNOTEUPDATE.
    This seems to cover 1,2,4,5,6 of the events I need to trap.
    Will anything trap for document print?

    LVL 46

    Accepted Solution


    See also SMTPMessageAcceptEMCallback
    I suppose the event is for the Domino server only, but I'm not quite sure here. It depends also on the way you receive mail: directly from the internet using POP3, from a server that receives mail directly, or from a server (or local) that receives mail through replication.

    There is a debugging setting that puts ALL events in the log. and search for CLIENT_CLOCK

    Print?? I doubt it...

    Author Closing Comment

    Thanks Sfef.

    I'm still groping a bit but I'm going to try doing most of it via the extension manager.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
    A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now