Umfrage

what is your favorite color?

blue
2 (66.7%)
red
1 (33.3%)

Stimmen insgesamt: 3

Autor Thema: Print a Lotus notes Document with C# DLL  (Gelesen 2652 mal)

Offline habiba_kessraoui

  • Frischling
  • *
  • Beiträge: 2
Print a Lotus notes Document with C# DLL
« am: 29.02.16 - 15:13:28 »
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:

Code
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:
Code
            /* Creat the notes session's object */ 
              System.Type typeNotes = System.Type.GetTypeFromProgID("Notes.NotesSession", "localhost", true); 
             dynamic oleSession = System.Activator.CreateInstance(typeNotes);

            /* Creat the notes dataBase's object */
            dynamic oleDb = oleSession.GetDatabase(serverName, baseName);

            /*Creat the notes NotesUIWorkspace's object */
            System.Type typeNotesUI = System.Type.GetTypeFromProgID("Notes.NotesUIWorkspace", "localhost", true);
            dynamic oleWK = System.Activator.CreateInstance(typeNotesUI);

            /* Open the notes dataBase's  */
            dynamic objDbUi = oleWK.OpenDatabase(serverName, baseName);

            dynamic oleDoc = oleDb.GetDocumentByUNID(UNID);

            Thread.Sleep(500);
            /*  opens the document having universal ID given as an argument  in the view in Edit mode.
             EDITDOCUMENT Return a notesUIDocument :oleUIDoc */
            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  ");
            }

            /* Print the curent Notes Document previously set */
            dynamic x = oleUIDoc.Print(0, 0, 0, false);

            oleUIDoc.close();

            /* Close the previously open notes dataBase */
            dynamic oleUIDB = oleWK.CurrentDatabase();

            oleUIDB.close();

            oleDoc = null;
            oleUIDoc = null;
            oleWK = null;
            oleDb = null;
            oleUIDB = null;
            oleSession = null;

Offline Tode

  • Moderatoren
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 6.883
  • Geschlecht: Männlich
  • Geht nicht, gibt's (fast) nicht... *g*
Re: Print a Lotus notes Document with C# DLL
« Antwort #1 am: 29.02.16 - 19:02:09 »
Cross- Posting. In the url everybody who wants to help can find more details that are missing here...
Gruss
Torsten (Tode)

P.S.: Da mein Nickname immer mal wieder für Verwirrung sorgt: Tode hat NICHTS mit Tod zu tun. So klingt es einfach, wenn ein 2- Jähriger versucht "Torsten" zu sagen... das klingt dann so: "Tooode" (langes O, das r, s und n werden verschluckt, das t wird zum badischen d)

Offline habiba_kessraoui

  • Frischling
  • *
  • Beiträge: 2
Re: Print a Lotus notes Document with C# DLL
« Antwort #2 am: 03.03.16 - 16:55:24 »
keine Lösung in diesem Link

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz