Learn how to a build a cloud-first strategyRegister Now


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

Posted on 2009-02-23
Medium Priority
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 vb.net 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
  • 4
  • 4
LVL 46

Expert Comment

by:Sjef Bosman
ID: 23719322
You need the Extension Manager services built into Notes. See:
- http://www.ibm.com/developerworks/lotus/library/capi-nd/index.html#N10170
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

ID: 23721652
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

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


I hope it'll help,
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

LVL 46

Expert Comment

by:Sjef Bosman
ID: 23721822
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

ID: 23722818
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
ID: 23723083
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: http://www.bruceelgort.com/blogs/be.nsf/plinks/BELT-6BMTBS

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

Author Comment

ID: 23723754
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

Sjef Bosman earned 1500 total points
ID: 23724200

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.
http://www.advancedclp.com/cool_tips.html and search for CLIENT_CLOCK

Print?? I doubt it...

Author Closing Comment

ID: 31550202
Thanks Sfef.

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Integration Management Part 2
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

810 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