I created a dll in C # that takes as a parameter the name of the Lotus Domino server, the name of the data base lotus notes and the UNID of a document of this base.The goal of this dll is to open in read mode the document having the UNID passed as parameter and then print the document via the printer installed on the machine. the problem is that sometimes the DLL instead of open the Document notes, it opens the attachment attached in this document and generates the following exception:
| COMException.Message = L'objet invoqué s'est déconnecté de ses clients. (Exception de HRESULT : 0x80010108 (RPC_E_DISCONNECTED)) |
| COMException.ErrorCode = -2147417848 |
| COMException.ToString = System.Runtime.InteropServices.COMException (0x80010108): L'objet invoqu‚ s'est d‚connect‚ de ses clients. (Exception de HRESULT : 0x80010108 (RPC_E_DISCONNECTED)) |
| … System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) |
| … System.Dynamic.ComRuntimeHelpers.GetITypeInfoFromIDispatch(IDispatch dispatch, Boolean throwIfMissingExpectedTypeInfo) |
| … System.Dynamic.IDispatchComObject.EnsureScanDefinedMethods() |
| … CallSite.Target(Closure , CallSite , ComObject , Int32 , Int32 , Int32 , Boolean ) |
| … CallSite.Target(Closure , CallSite , Object , Int32 , Int32 , Int32 , Boolean ) |
| … PrintNotesUIDocumentCOM_version_14_12_2015.PrintNotesDocument_version_14_12_2015.PrintFaxDocument_version_14_12_2015(String serverName, String baseName, String UNID) |
| COMException.Data = System.Collections.ListDictionaryInternal |
this is the code of the dll ,may be it help:
| |
| System.Type typeNotes = System.Type.GetTypeFromProgID("Notes.NotesSession", "localhost", true); |
| dynamic oleSession = System.Activator.CreateInstance(typeNotes); |
| |
| |
| dynamic oleDb = oleSession.GetDatabase(serverName, baseName); |
| |
| |
| System.Type typeNotesUI = System.Type.GetTypeFromProgID("Notes.NotesUIWorkspace", "localhost", true); |
| dynamic oleWK = System.Activator.CreateInstance(typeNotesUI); |
| |
| |
| dynamic objDbUi = oleWK.OpenDatabase(serverName, baseName); |
| |
| dynamic oleDoc = oleDb.GetDocumentByUNID(UNID); |
| |
| Thread.Sleep(500); |
| |
| |
| dynamic oleUIDoc = null; |
| |
| if (oleDoc != null) |
| { |
| Console.WriteLine("/C#\\ befor editdocument "); |
| oleUIDoc = oleWK.EDITDOCUMENT(false, oleDoc, false,"",true,false); |
| |
| Console.WriteLine("/C#\\ after editdocument "); |
| } |
| else |
| { |
| Console.WriteLine("/C#\\ oledoc = null "); |
| } |
| |
| |
| dynamic x = oleUIDoc.Print(0, 0, 0, false); |
| |
| oleUIDoc.close(); |
| |
| |
| dynamic oleUIDB = oleWK.CurrentDatabase(); |
| |
| oleUIDB.close(); |
| |
| oleDoc = null; |
| oleUIDoc = null; |
| oleWK = null; |
| oleDb = null; |
| oleUIDB = null; |
| oleSession = null; |