使用基于服务器的 LotusScript 为 Outlook 和 Notes 客户端创建日历条目
Create calendar entry with server-based LotusScript for Outlook and Notes clients
任务:创建一封电子邮件,该电子邮件会导致在收件人的日历中创建一个日历条目。同一封电子邮件应该适用于 Lotus Notes 或 Outlook 客户端。代码将位于基于 Intranet 的 Lotus Notes 表单上的 WebQuerySave 事件调用的 LotusScript 代理中(即代码使用登录用户的凭据在 Domino 9 服务器上运行)。
如果用户必须单击电子邮件中的某些内容才能创建日历条目,那也没关系。
理想情况下:我希望能够直接创建 MIME 内容,而不必费心创建 ics 文件附件,因为服务器上的安全性限制使其成为问题创建和删除临时文件。同样,如果可能的话,由于此类事情的审批流程,我想避免使用第 3 方插件。
我试过: 几种不同的编写 MIME 条目的组合在 Notes 客户端中取得了小的成功,但到目前为止在 Outlook 客户端中没有成功。我知道生成的 MIME 消息应该是什么样子(通过将在 Lotus Notes 中创建的常规日历条目发送到 Thunderbird 客户端并使用 Ctrl-U 查看源代码),我可以模拟它,但我一直无法发送以不会被邮件路由器扰乱的方式。
我尝试创建 MIME 流:
' .. Regular setup code here
Set stream = session.Createstream()
session.ConvertMime = False
Set docMemo = db.Createdocument()
docMemo.Form = "Memo"
Set body = docMemo.Createmimeentity
' .. create subject and To fields in the header entity here
Call stream.Writetext(".. the exact text that I want to be in the message as it appears in the recipient inbox in MIME format")
' for example:
' This is a multipart message in MIME format.
' --=_mixed 5DB3BEC8067B2AAFCA2582430012A396_=
' Content-Type: multipart/related; boundary="=_related 5DB3BEC8067B2AAFCA2582430012A396_="
'
' --=_related 5DB3BEC8067B2AAFCA2582430012A396_=
' Content-Type: multipart/alternative; boundary="=_alternative 5DB3BEC8067B2AAFCA2582430012A396_="
'
' --=_alternative 5DB3BEC8067B2AAFCA2582430012A396_=
' Content-Type: text/plain; charset=US-ASCII
' Content-Transfer-Encoding: quoted-printable
'
' =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
' =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
' =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
' Broadcast: Test outlook 3=20=20=20=20=20=20=20=20=20=20=20=
' =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
' etc...
call body.Setcontentfromtext(stream, "text/HTML;charset=UTF-8", ENC_IDENTITY_7BIT)
Call docMemo.Send(False)
session.Convertmime = True
然后我尝试将 MIME 格式的消息放入富文本字段并将其转换为 MIME:
' .. Regular setup code here
Set docMemo = db.Createdocument()
docMemo.Form = "Memo"
Set rtiBody = New NotesRichTextItem(docMemo, "Body")
' .. create subject and To fields here
Call rtiBody.AppendText(".. the exact text that I want to be in the message as it appears in the recipient inbox in MIME format")
' same MIME content as code example above
call docMemo.Converttomime(2) ' 2 = CONVERT_RT_TO_HTML_
Call docMemo.Send(False)
我想我一定是误解了一些关于邮件路由器期望的内容以及它所做的转换的基本知识。
另一种方法是创建共享日历 link,如本 Office 支持文档 Create an Add to calendar link in an email message 中所述,Outlook 可以访问该日历。遗憾的是,这不能使用,因为它需要一个共享位置来存储 ics 文件附件,这在这种情况下不合适。
我几乎卡住了,不确定接下来要尝试什么。
只需忘记 "MIME"- 完全填充并使用表单 "Notice" 创建一个文档并填写所需的字段。 Domino 将自动为外部收件人创建邀请。为了知道您必须填写哪些字段,您可以使用 IBM Calendaring & Scheduling Schema。
如果您需要完全控制 MIME 而不是听从 Torsten 的建议,您仍然不想自己创建 MIME header、分隔符和内容。 NotesMIMEEntity class 会为您做到这一点,当您这样做时,路由器会做正确的事情。
您需要使用 class 中的适当方法进行设置。根据上面不完整的代码,你需要创建一个parent实体,然后使用CreateChildEntity a child entity of the parent, and use that same method on the child entity to create a child of the child entity. You'll use CreateHeader将parent的Content-type设置为multipart/related,用同样的方法将child的Content-type设置为multipart/alternative,再次将child-of-the-child的Content-type设置为text/plain .您将使用 SetContentFromText 来设置您想要的消息文本,如果您确实需要 quoted-printable,您也可以在 child-of-a-child 上设置 header。我假设至少有两个其他实体对应于您没有显示的部分 - 因为您有两个级别的多部分,显然应该有额外的部分。
任务:创建一封电子邮件,该电子邮件会导致在收件人的日历中创建一个日历条目。同一封电子邮件应该适用于 Lotus Notes 或 Outlook 客户端。代码将位于基于 Intranet 的 Lotus Notes 表单上的 WebQuerySave 事件调用的 LotusScript 代理中(即代码使用登录用户的凭据在 Domino 9 服务器上运行)。
如果用户必须单击电子邮件中的某些内容才能创建日历条目,那也没关系。
理想情况下:我希望能够直接创建 MIME 内容,而不必费心创建 ics 文件附件,因为服务器上的安全性限制使其成为问题创建和删除临时文件。同样,如果可能的话,由于此类事情的审批流程,我想避免使用第 3 方插件。
我试过: 几种不同的编写 MIME 条目的组合在 Notes 客户端中取得了小的成功,但到目前为止在 Outlook 客户端中没有成功。我知道生成的 MIME 消息应该是什么样子(通过将在 Lotus Notes 中创建的常规日历条目发送到 Thunderbird 客户端并使用 Ctrl-U 查看源代码),我可以模拟它,但我一直无法发送以不会被邮件路由器扰乱的方式。
我尝试创建 MIME 流:
' .. Regular setup code here
Set stream = session.Createstream()
session.ConvertMime = False
Set docMemo = db.Createdocument()
docMemo.Form = "Memo"
Set body = docMemo.Createmimeentity
' .. create subject and To fields in the header entity here
Call stream.Writetext(".. the exact text that I want to be in the message as it appears in the recipient inbox in MIME format")
' for example:
' This is a multipart message in MIME format.
' --=_mixed 5DB3BEC8067B2AAFCA2582430012A396_=
' Content-Type: multipart/related; boundary="=_related 5DB3BEC8067B2AAFCA2582430012A396_="
'
' --=_related 5DB3BEC8067B2AAFCA2582430012A396_=
' Content-Type: multipart/alternative; boundary="=_alternative 5DB3BEC8067B2AAFCA2582430012A396_="
'
' --=_alternative 5DB3BEC8067B2AAFCA2582430012A396_=
' Content-Type: text/plain; charset=US-ASCII
' Content-Transfer-Encoding: quoted-printable
'
' =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
' =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
' =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
' Broadcast: Test outlook 3=20=20=20=20=20=20=20=20=20=20=20=
' =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
' etc...
call body.Setcontentfromtext(stream, "text/HTML;charset=UTF-8", ENC_IDENTITY_7BIT)
Call docMemo.Send(False)
session.Convertmime = True
然后我尝试将 MIME 格式的消息放入富文本字段并将其转换为 MIME:
' .. Regular setup code here
Set docMemo = db.Createdocument()
docMemo.Form = "Memo"
Set rtiBody = New NotesRichTextItem(docMemo, "Body")
' .. create subject and To fields here
Call rtiBody.AppendText(".. the exact text that I want to be in the message as it appears in the recipient inbox in MIME format")
' same MIME content as code example above
call docMemo.Converttomime(2) ' 2 = CONVERT_RT_TO_HTML_
Call docMemo.Send(False)
我想我一定是误解了一些关于邮件路由器期望的内容以及它所做的转换的基本知识。
另一种方法是创建共享日历 link,如本 Office 支持文档 Create an Add to calendar link in an email message 中所述,Outlook 可以访问该日历。遗憾的是,这不能使用,因为它需要一个共享位置来存储 ics 文件附件,这在这种情况下不合适。
我几乎卡住了,不确定接下来要尝试什么。
只需忘记 "MIME"- 完全填充并使用表单 "Notice" 创建一个文档并填写所需的字段。 Domino 将自动为外部收件人创建邀请。为了知道您必须填写哪些字段,您可以使用 IBM Calendaring & Scheduling Schema。
如果您需要完全控制 MIME 而不是听从 Torsten 的建议,您仍然不想自己创建 MIME header、分隔符和内容。 NotesMIMEEntity class 会为您做到这一点,当您这样做时,路由器会做正确的事情。
您需要使用 class 中的适当方法进行设置。根据上面不完整的代码,你需要创建一个parent实体,然后使用CreateChildEntity a child entity of the parent, and use that same method on the child entity to create a child of the child entity. You'll use CreateHeader将parent的Content-type设置为multipart/related,用同样的方法将child的Content-type设置为multipart/alternative,再次将child-of-the-child的Content-type设置为text/plain .您将使用 SetContentFromText 来设置您想要的消息文本,如果您确实需要 quoted-printable,您也可以在 child-of-a-child 上设置 header。我假设至少有两个其他实体对应于您没有显示的部分 - 因为您有两个级别的多部分,显然应该有额外的部分。