0

Im writing a silverlight application in vb.net and need to send an email via lotus notes. I wish to do this by opening the lotus notes client app, open a new email window and substitute all the necessary details (to, subject etc.) in the new email window. I am using the below code but it only OPENS the lotus notes application on the machine, it does not do anything past this. Its seems that everything after the initial CreateObject call is simply ignored, although it doesnt throw any errors. I have attempt to reference interops.domino.dll but being silverlight project visual studio states the dll is not compiled for the silverlight runtime. Any assistance with this would be greatly appreciated.

Dim outlook = AutomationFactory.CreateObject("Notes.NotesSession")
Dim notesdb = outlook.GetDatabase("", "")                                                                                                 

notesdb.OpenMail()                                                                                            
Dim doc = notesdb.CreateDocument()

Dim msg = "Hey whats up"

doc.ReplaceItemValue("SendTo", "person@temp.com")                                                                                           
doc.ReplaceItemValue("Subject", "Hello")                                                                                              
Dim rtitem = doc.CreateRichTextItem("Body")                                                                                           
rtitem.AppendText(msg)

2 Answers2

-1

All you do in the moment is to create a new document in the backend and fill it with values. It is like creating a word document without opening it...

You need some more code to actually SHOW the document you created. In addition you need to assign a Form, otherwise Notes will not know, how to display this document:

Dim session = AutomationFactory.CreateObject("Notes.NotesSession")
Dim notesdb = outlook.GetDatabase("", "")   
Dim ws = AutomationFactory.CreateObject("Notes.NotesUIWorkspace")
notesdb.OpenMail()
Dim doc = notesdb.CreateDocument()

Dim msg = "Hey whats up"

doc.ReplaceItemValue("Form", "Memo")
doc.ReplaceItemValue("SendTo", "person@temp.com")
doc.ReplaceItemValue("Subject", "Hello")
Dim rtitem = doc.CreateRichTextItem("Body") 
rtitem.AppendText(msg)

ws.EditDocument( True, doc )

As I do not use silverlight I unfortunately could not test the code, but It should point into the right direction.

Tode
  • 11,795
  • 18
  • 34
-1

You can not do UI manipulations via COM in Notes, as the UI-Classes (NotesUIDocument, NotesUIWorkspace, ...) are not supported via COM.

You can only use the backend-classes likes NotesDocument, ...

This still leaves you a lot of possibilites, as you can eiter use NotesRichTextItem or MIMEEntity classes to compose e-mails.

rene
  • 41,474
  • 78
  • 114
  • 152
leyrer
  • 1,444
  • 7
  • 9
  • Torsten, care the expand? Designer help states: "NotesUIDocument class: Represents the document that's currently open in the Notes workspace.Note: This class is not supported in COM." – leyrer Sep 11 '13 at 09:14
  • You are absolutely right. BUT: OLE != COM >>> http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=%2Fcom.ibm.designer.domino.main.doc%2FH_USING_NOTES_CLASSES_IN_VISUAL_BASIC.html – Tode Sep 11 '13 at 09:32