Printing eMails

I am new to Lotus Notes programming. I have written a C# program that monitors an inbox and prints out the body of an email using Microsoft Office Document Imaging (MODI). To do this, I use the Notes UI classes through Interop services. I get a pointer to the Notes Document, call EditDocument to get a UI Document then call the print method. This seems to work fine most of the time. I do get the dreaded System.Runtime.InteropServices.COMException (0x80010105): The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)) on the EditDocument call whereby I have to shut down the program and Lotus Notes Client. Occasionally I have to reboot the machine to get the process running again.

Question: Is there a better way to accomplish this task using the back-end apis? Is this the preferred approach or is there a better one out there?

Subject: Notes automation handles in C#

How are you getting the COM instances of the UI objects in C#? Are you using late-binding?

If you don’t mind, could you post your C# code of how you’re getting the handles on the NotesUIWorkspace instance? Thanks!

Subject: Also getting something similar

Hi Phillip, di you eventually solve this issue?

I am getting somthing similar with the following VB code:

Dim objDoc As Object

Dim objDb As Object

objDb = objSession.GetDatabase(strDbPath, strDbName)

objDoc = objDb.CreateDocument

objDoc.Form = “memo”

objRtitem = objDoc.CreateRichTextItem(“Body”)

Call appendContent(objRtitem, strFiles)

Call objDoc.save(True, True)

objUIDoc = objLotusNotes.EditDocument(True, objDoc, False)

I can’t reproduce the error but some colleagues can while others can’t. Could it be an environmental issue with Notes? I can confirm that they are seeing it on Lotus Notes 7.0.2 and Lotus Notes 8.5.2.