Link to me: Notes Document Links as URL, Notes Link and Attachments
In the beginning the world was easy. You wanted to notify a user, just use @MailSend with [IncludeDocLink] and your email notification was done. It was obvious if your application was on a Notes client, your messaging application would be Notes as well.
Today the picture looks different. You might access your email through a portlet on the intranet or through a POP3 client. But you still want to be able to open that link in the Notes client right? I'm not aiming at web enablement here. What are your options:
This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.
Today the picture looks different. You might access your email through a portlet on the intranet or through a POP3 client. But you still want to be able to open that link in the Notes client right? I'm not aiming at web enablement here. What are your options:
- In a Notes client you can use NotesRichText.AppendDocLink
- You could send a link with notes:// ...
- You can create an attachment as NDL file: To see what you need in there you copy a document link and paste it into Notepad. You will get this result:
Wissel's Address Book - My Contacts
<NDL>
<REPLICA 4825713F:00352EEC>
<VIEW OF85255E01:001356A8-ON852554C2:00753106>
<NOTE OFE3DB4DB9:F46B6DAE-ON482572F9:00366DC6>
<HINT>CN=d23m0120/OU=23/OU=M/O=IBM</HINT>
<REM>Wissel's Address Book</REM>
</NDL>
Looks utterly familiar. Inside the NOTE the document uniqueID is embedded similar to the value in the property box. The stuff around the NotesDocument.UniversalID is static, so we can construct that. The view is the uniqueID of the design document. Luckily you can replace that with the name or alias of that view
Public Class DocLinkHelper Private s As NotesSession Private db As NotesDatabase Private doc As NotesDocument Private v As NotesView Sub New (curDoc As NotesDocument ) Set doc = curDoc Set s = New NotesSession Set db = doc .ParentDatabase Set v = doc .ParentView End Sub Function NotesURL As String Dim vName As String If v Is Nothing Then vName = "/0/" Else If Isarray (v .Aliases ) Then vName = "/" + v .Aliases (0 ) + "/" Else vName = "/" + v . Name + "/" End If End If NotesURL = "notes://" +db .Server +vName +doc .UniversalID End Function Sub AppendLink (rt As NotesRichTextItem ) Call rt .AppendDocLink (doc ,doc .form (0 ) ) End Sub Sub AttachNotesLink (mailDoc As NotesDocument ) Dim out As NotesStream Dim linkFileName As String Dim rt As NotesRichTextItem Dim repID As String Dim viewID As String Dim noteID As String Dim unid As String linkFileName = "NotesLink-" +doc .UniversalID + ".ndl" Set out = s .CreateStream If Dir$ (linkFileName ) < > "" Then Kill linkFileName End If Call out . Open (linkFileName ) %REM The NDL Format looks like this: Wissel's Address Book - My Contacts <NDL> <REPLICA 4825713F:00352EEC> <VIEW OF85255E01:001356A8-ON852554C2:00753106> <NOTE OFE3DB4DB9:F46B6DAE-ON482572F9:00366DC6> <HINT>CN=d23m0120/OU=23/OU=M/O=IBM</HINT> <REM>Wissel's Address Book</REM> </NDL> %END REM repId = Left (db .ReplicaID ,8 ) + ":" + Right (db .ReplicaID ,8 ) If Isarray (v .Aliases ) Then viewID = v .Aliases (0 ) Else viewID = v . Name End If unid = doc .UniversalID noteID = "OF" + Left (unid ,8 ) noteID = noteID + ":" + Mid (unid ,9 ,8 ) noteID = noteID + "-ON" + Mid (unid ,17 ,8 ) noteID = noteID + ":" + Right (unid ,8 ) Call out .WriteText (db .Title + " - " + v . Name ,EOL_CRLF ) Call out .WriteText ( "<NDL>" ,EOL_CRLF ) Call out .WriteText ( "<REPLICA " +repID + ">" ,EOL_CRLF ) Call out .WriteText ( "<VIEW " +viewID + ">" ,EOL_CRLF ) Call out .WriteText ( "<NOTE " +noteID + ">" ,EOL_CRLF ) Call out .WriteText ( "<HINT>" +db .Server + "</HINT>" ,EOL_CRLF ) Call out .WriteText ( "<REM>" +db .Title + "</REM>" ,EOL_CRLF ) Call out .WriteText ( "</NDL>" ,EOL_CRLF ) Call out . Close If mailDoc .HasItem ( "Body" ) Then Set rt = mailDoc .GetFirstItem ( "Body" ) Else Set rt = New NotesRichTextItem (mailDoc , "Body" ) End If Call rt .EmbedObject ( EMBED_ATTACHMENT , "" ,linkFileName ) Kill linkFileName End Sub End Class
provided by Julian Robichaux at nsftools.com.
Posted by Stephan H Wissel on 26 November 2007 | Comments (5) | categories: Show-N-Tell Thursday