0
votes

I'm trying to integrate Lotus Notes into my program. I already finished sending new mail and I try to check new input messages from mail incoming into lotus notes. In official IBM documentation, I found a function that returns all unread messages, but in C# this function not available... Is there a way to do this?

notesNoteCollection = notesDatabase.GetAllUnReadDocuments( [username] )

http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=%2Fcom.ibm.designer.domino.main.doc%2FH_GETALLUNREADDOCUMENTS_DATABASE.html

1
GetAllUnreadDocuments would not be a good way to check for new email messages. It would keep getting you the same set of documents every time, until the user reads them with the Notes client. Unfortunately, there is no simple way in the Notes COM classes to check for new messages. Typically, you would have to keep state information locally and look for changes. E.g., save the datetime last checked, and look for messages created since that datetime, and there's no particularly efficent way to do it. (That's not necessarily a huge problem, depending on your scale.) - Richard Schwartz
There may be other, newer APIs from IBM that do this more efficiently (e.g., for mobile), but if there are I'm not familiar with them. Also, the Notes C API might expose a way to do it, but the only ways I'm familar with would involve a server add-in -- which I'm guessing is beyond the scope of what you want to do. - Richard Schwartz
Richard Schwartz, thank you - Alex_Frisker

1 Answers

0
votes

I can't tell from the original question, but is your C# program using the Notes C API? If so, you can use NSFDbModifiedTime to check if any data documents have been created or changed since a given time. Here's the documentation:

http://www-12.lotus.com/ldd/doc/domino_notes/9.0/api90ref.nsf/ef2467c10609eaa8852561cc0067a76f/85255d56004d3f6385255bba0073586d?OpenDocument

If that function tells you something has changed, you still need to open the inbox folder to see if new mail has arrived, but NSFDbModifiedTime is very quick. It will save you from opening the inbox folder unnecessarily.