Q

How do detect when a Lotus user deletes an e-mail

Hi, Andre. I want to know how to detect when a Lotus user deletes an e-mail. I would like to do it from an agent that runs on the server.

Someone told me that I had to work with the "postdocumentdelete" event of "database script" from the user. But this is not good for me, because it uses (I think) client classes, and I need to use server resources like environment variables or XML files.

Can you help me, please?
There are a couple of approaches you could investigate.

There's no way to directly trigger a server agent when documents are about to be deleted. However, in the Querydocumentdelete of the database script, you can use NotesAgent.RunOnServer method to call a server agent, passing in as a parameter the note ID of one document that is about to be deleted. The server agent can do whatever needs to be done.

This will only detect deletions done via the Notes client UI, however. If the user runs an agent that delete documents, this event is not triggered. Also, things get complicated with "soft deletions" -- when they delete a document it's not really getting deleted right away.

Even without soft deletions, do you want to execute this code when the user flags the document for deletion, or when they exit the database or press F9 and it's actually deleted? If you respond to PostDocumentDelete, you also need to be prepared to respond to QueryDocumentUndelete and undo whatever you did when the document was flagged for deletion.

Alternately, you could use the "DSAPI" to write add-in code on the server. This subset of the Notes C API lets you register your code to run when various events occur on the server, including deletion of a document. You would have to write this code in C or C++, and it would only trigger when the document is really deleted – not soft deleted or flagged in the view to be deleted later.

Do you have comments on this Ask the Expert question and response? Let us know.

This was last published in May 2004

Dig Deeper on Lotus Notes Domino Agents

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close