目前正在開發用於Lotus Notes的插件,並且在理解Notes API時遇到了一些問題。如何以編程方式創建新郵件信息以在蓮花筆記中進行編輯?
我希望能夠在我的插件視圖中單擊一個按鈕,並觸發打開可編輯的新郵件消息,並具有已設置的附件和文本。我可以通過shell命令執行此操作,但尚未從Java Eclipse RCP插件中找到適當的API調用。
如何從Lotus Notes Eclipse插件以編程方式打開「新郵件」消息?
感謝
目前正在開發用於Lotus Notes的插件,並且在理解Notes API時遇到了一些問題。如何以編程方式創建新郵件信息以在蓮花筆記中進行編輯?
我希望能夠在我的插件視圖中單擊一個按鈕,並觸發打開可編輯的新郵件消息,並具有已設置的附件和文本。我可以通過shell命令執行此操作,但尚未從Java Eclipse RCP插件中找到適當的API調用。
如何從Lotus Notes Eclipse插件以編程方式打開「新郵件」消息?
感謝
你需要指定「新郵件」爲mailto
鏈路和執行鏈接。 參見:http://www.ibm.com/developerworks/lotus/library/notes8-data/
您可以通過操作系統的API實現這個動作,而不是通過Lotus Notes的API。具體來說,電子郵件操作使用mailto URL協議來創建新郵件。 雖然這些鏈接的規範還允許傳遞其他幾條數據。特別是,該動作使用指定消息正文的功能。您也可以放棄收件人,因此您的鏈接看起來像
mailto:?body=It+would+be+nice+to+email+from+here
。 因爲Lotus Notes實現了這個協議,所以像這樣的鏈接可以正確地創建一個包含給定主體的新電子郵件。你所要做的就是啓動鏈接。
要使用Notes API創建電子郵件,您需要編寫如下代碼。這是通過點擊按鈕創建可編輯電子郵件的工作代碼。此代碼將向用戶顯示一個消息框,詢問他們想要添加到消息中的文本。用戶可以選擇在發送之前取消電子郵件。
Sub Click(Source As Button)
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument, doc2 As NotesDocument
Dim itemRT As NotesRichTextItem
Dim item As NotesItem
Dim strComments As String
Dim strBody As String
Dim strSubject As String
Dim varSubject As Variant
Dim strInputText As String
Const NEW_LINE = |
|
'This section is used to select who will receive responses, enter the number of people who will receive responses next to SendTo, and then below specify the people starting with (0) -----
'--------------------------------------------------------------------------------------
Dim SendTo(2) As String
SendTo(0) = "Notes ID of email recipient"
'--------------------------------------------------------------------------------------
'This section determines what the subject tag line will be for the feedback note. Enter what you would like next to SubjTemp
'--------------------------------------------------------------------------------------
Dim SubjTemp As String
SubjTemp = "Feedback -- "
'--------------------------------------------------------------------------------------
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
Set db = session.CurrentDatabase
Set itemRT=doc.getFirstItem("body") ' get rid of attachments from background document
If doc.HasEmbedded = True Then ' see if background document has any attachments
Forall x In itemRT.EmbeddedObjects
If x.type=1454 Then
x.remove
End If
End Forall
End If
Set doc2 = doc.CreateReplyMessage(False)
Set item = doc.GetFirstItem("Subject")
varSubject = item.Values
strSubject = SubjTemp & varSubject(0)
Set item = doc2.ReplaceItemValue("Subject", strSubject)
strInputText = "Thank you for providing us with your valuable feedback!" & NEW_LINE & "Please enter your comments in the space below." & NEW_LINE & "If you do not want to send a feedback, click on Cancel."
strComments = Inputbox$(strInputText, "Comments")
If strComments = "" Then
Msgbox "You did not enter any comments, a feedback message will not be sent."
Else
strBody = "Very Useful" & NEW_LINE & NEW_LINE & "Comments: " & strComments
Set item = doc2.ReplaceItemValue("Rating", "Very Useful")
Set item = doc2.ReplaceItemValue("Comments", strComments)
Call doc2.Removeitem("Body") ' get rid of original body field
Set item = doc2.ReplaceItemValue("Body", strBody)
doc2.SendTo = SendTo
Call doc2.Send(False)
Messagebox "Thank you for your feedback, a message has been sent.", MB_OK, "Message Sent"
End If
末次
謝謝你的回答。據我所知,這是LotusScript。我將如何將它集成到Java Eclipse RCP插件中? –
當前正在生產的Notes客戶端基於eclipse。我理解你的問題是如何在Notes中使用Notes API(例如將它放在eclipse中)。你是否試圖通過程序從外部應用程序驅動這個?如果是這樣,可能需要使用Notes C/C++ API。 –
如果是基於Eclipse的應該不是Java API?是的,這是我正在嘗試做的事情,API不是最好的評論之一...... –
我會假設這也是依賴於一個事實,即注意的是,被配置爲默認郵件客戶端,客戶端。是嗎? –
是的假設是正確的。 –
好吧,就我所見,我可以調用一個進程,就像這個問題一樣http://stackoverflow.com/questions/5604698/java-programming-call-an-exe-from-java-and-passing - 參數,但我真的不知道如何在部署插件後找到notes.exe ...您是否知道Lotus API中的某個位置,其中可以找到Notes安裝文件夾(以及註釋。可執行程序)? –