سؤال

I'm looking for a way to start Lotus Notes and control its utilisation from a vb.net project.

By controlling I mean litle things like getting the window position, closing active document and other stuff.

But the main objective is to start a session.

I'm confused because I tried to use the Lotus Notes Automation Classes dll and nothing worked well...

If anyone had some tips for me, I would apreciate a lot! Thanks! (by the way, sorry english is not my main language)

هل كانت مفيدة؟

المحلول

In Notes speak, a session is a backend object, not a UI object. What you describe (changing window position, closing active window, etc) is UI functionality.

Notes supports COM, and you have full access to all backend classes. But you don't have access to the UI classes.

Why would you want to automate the actual Notes client? If you describe what you are ultimately wanting to do, perhaps we can help. I am sure that the correct way to solve what you are trying to do is to use the backend classes...

نصائح أخرى

I found a way to start Notes, I needed to use process:

 Private Sub StartNotes()
    Dim p As Process = New Process()

    p.StartInfo.FileName = "C:\Program Files\Notes\notes.exe"
    p.StartInfo.Arguments = ""

    p.Start()

  End Sub

I automate it after using backend classes from lotus and domino dll

Sub Send_Email_via_Lotus_Notes()
Dim Maildb As Object
Dim MailDoc As Object
Dim Body As Object
Dim Session As Object
'Start a session of Lotus Notes
    Set Session = CreateObject("Lotus.NotesSession")
'This line prompts for password of current ID noted in Notes.INI
    Call Session.Initialize
'or use below to provide password of the current ID (to avoid Password prompt)
    'Call Session.Initialize("<password>")
'Open the Mail Database of your Lotus Notes
    Set Maildb = Session.GETDATABASE("", "D:\Notes\data\Mail\eXceLiTems.nsf")
    If Not Maildb.IsOpen = True Then Call Maildb.Open
'Create the Mail Document
    Set MailDoc = Maildb.CREATEDOCUMENT
    Call MailDoc.REPLACEITEMVALUE("Form", "Memo")
'Set the Recipient of the mail
    Call MailDoc.REPLACEITEMVALUE("SendTo", "Ashish Jain")
'Set subject of the mail
    Call MailDoc.REPLACEITEMVALUE("Subject", "Subject Text")
'Create and set the Body content of the mail
    Set Body = MailDoc.CREATERICHTEXTITEM("Body")
    Call Body.APPENDTEXT("Body text here")
'Example to create an attachment (optional)
    Call Body.ADDNEWLINE(2)
    Call Body.EMBEDOBJECT(1454, "", "C:\dummy.txt", "Attachment")
'Example to save the message (optional) in Sent items
    MailDoc.SAVEMESSAGEONSEND = True
'Send the document
'Gets the mail to appear in the Sent items folder
    Call MailDoc.REPLACEITEMVALUE("PostedDate", Now())
    Call MailDoc.SEND(False)
'Clean Up the Object variables - Recover memory
    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set Body = Nothing
    Set Session = Nothing
End Sub
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top