如何在Lotus Notes的MIME电子邮件中包括DocLink?

时间:2019-05-13 14:58:42

标签: lotus-notes lotusscript lotus

我希望使用DocLink获取MIME或要包含在LotusScript电子邮件中的文档链接的值,但是我不知道该怎么做。

我有这个:

Sub Click(Source As Button)

    Dim s As New NotesSession 
    Dim db As NotesDatabase 
    Dim doc As NotesDocument
    Dim body As NotesMIMEEntity 
    Dim header As NotesMIMEHeader 
    Dim stream As NotesStream

    Set db = s.CurrentDatabase 
    Set stream = s.CreateStream 
    s.ConvertMIME = False

    Set doc = db.CreateDocument 
    doc.Form = "Memo"

    Set body = doc.CreateMIMEEntity 
    Set header = body.CreateHeader("Subject")

    Call header.SetHeaderVal("HTML message") 
    Set header = body.CreateHeader("To")
    Call header.SetHeaderVal("email_domain")

    Call stream.writetext(|<HTML>|) 
    Call stream.writetext(|<body>|) 
    user$ = s.CommonUserName 
    Call stream.writetext(|<br><font size="+5" color="red">| & user$ &|</font>|) 
    Call stream.WriteText(|<br><a href="notes:///server/etc/etc">Notes</a><br>|)    
    Call stream.writetext(|</body>|) 
    Call stream.writetext(|</html>|)

    Call body.SetContentFromText(stream, "text/HTML;charset=UTF-8", ENC_IDENTITY_7BIT) 
    Call doc.Send(False) 
    s.ConvertMIME = True 

End Sub

在这段代码中,我可以在URL注释中包含<a></a>标签,但是我确实想像使用AppendDocLink一样生成此文档的链接。

有可能吗?

1 个答案:

答案 0 :(得分:0)

最后,我找到了UniversalID的解决方案。我检索了文档的ID,然后将其添加到URL,

Sub Click(Source As Button)

    Dim ws As New NotesUIWorkspace
    Dim s As New NotesSession 
    Dim db As NotesDatabase 
    Dim doc As NotesDocument
    Dim doc2 As NotesDocument
    Dim body As NotesMIMEEntity 
    Dim header As NotesMIMEHeader 
    Dim stream As NotesStream
    Dim urldoc As String

    Set doc2 = ws.CurrentDocument.Document

    Set db = s.CurrentDatabase 
    Set stream = s.CreateStream 
    s.ConvertMIME = False

    urldoc = doc2.UniversalID

    Set doc = db.CreateDocument 
    doc.Form = "Memo"

    Set body = doc.CreateMIMEEntity 
    Set header = body.CreateHeader("Subject")

    Call header.SetHeaderVal("HTML message") 
    Set header = body.CreateHeader("To")
    Call header.SetHeaderVal("email")

    Call stream.writetext(|<HTML>|) 
    Call stream.writetext(|<body>|) 
    user$ = s.CommonUserName 
    Call stream.writetext(|<br><font size="+5" color="red">| & user$ &|</font>|) 
    Call stream.WriteText(|<br><a href="Notes://Server/Replica/View/| & urldoc & |">Notes</a><br>|)
    Call stream.writetext(|</body>|) 
    Call stream.writetext(|</html>|)

    Call body.SetContentFromText(stream, "text/HTML;charset=UTF-8", ENC_IDENTITY_7BIT) 
    Call doc.Send(False) 
    s.ConvertMIME = True 

End Sub