2015-09-07 53 views
1

目前正在开发用于Lotus Notes的插件,并且在理解Notes API时遇到了一些问题。如何以编程方式创建新邮件信息以在莲花笔记中进行编辑?

我希望能够在我的插件视图中单击一个按钮,并触发打开可编辑的新邮件消息,并具有已设置的附件和文本。我可以通过shell命令执行此操作,但尚未从Java Eclipse RCP插件中找到适当的API调用。

如何从Lotus Notes Eclipse插件以编程方式打开“新邮件”消息?

感谢

回答

1

你需要指定“新邮件”为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实现了这个协议,所以像这样的链接可以正确地创建一个包含给定主体的新电子邮件。你所要做的就是启动链接。

+0

我会假设这也是依赖于一个事实,即注意的是,被配置为默认邮件客户端,客户端。是吗? –

+0

是的假设是正确的。 –

+0

好吧,就我所见,我可以调用一个进程,就像这个问题一样http://stackoverflow.com/questions/5604698/java-programming-call-an-exe-from-java-and-passing - 参数,但我真的不知道如何在部署插件后找到notes.exe ...您是否知道Lotus API中的某个位置,其中可以找到Notes安装文件夹(以及注释。可执行程序)? –

1

要使用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 

末次

+0

谢谢你的回答。据我所知,这是LotusScript。我将如何将它集成到Java Eclipse RCP插件中? –

+0

当前正在生产的Notes客户端基于eclipse。我理解你的问题是如何在Notes中使用Notes API(例如将它放在eclipse中)。你是否试图通过程序从外部应用程序驱动这个?如果是这样,可能需要使用Notes C/C++ API。 –

+0

如果是基于Eclipse的应该不是Java API?是的,这是我正在尝试做的事情,API不是最好的评论之一...... –