Question

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)
Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top