I wanted to be able to get the url for the current document(s) in my mail database so I could paste them in another application and then click on the URLs to access the original messages directly from within that other app as needed.
I cobbled together a little LotusScript agent that grabs the NotesURL from each document and then scrubs out that junk that Lotus includes for no discernible reason.
So
notes://NotesServer@mydomain/__85256EDA00695075.nsf/0/EEF8D00A7E50A458852573BE0069A402?OpenDocument
becomes
notes://NotesServer/85256EDA00695075/0/EEF8D00A7E50A458852573BE0069A402?OpenDocument
This script will show the result in a messagebox. I also have it insert the URL into the clipboard for me but I’ve scraped that out so as not to confuse the issue.
It’s not as pretty as I’d like, but this should help others trying to get a useful URL out of Lotus’ terrible implementation.
Dim sess As New NotesSession
Dim doc As NotesDocument
Dim coll As NotesDocumentCollection
Dim sTempURL As String
Dim sURL As String
Dim iPosAT As Integer
Dim iPosSlashUnderscores As Integer
Dim iPosNSF As Integer
Set coll = sess.CurrentDatabase.UnprocessedDocuments
Set doc = coll.GetFirstDocument
sURL = “”
While Not doc Is Nothing
sTempURL = doc.NotesURL
iPosAT=Instr(sTempURL,”@”)
iPosSlashUnderscores = Instr(sTempURL,”/__”)
iPosNSF = Instr(iPosSlashUnderscores+1,sTempURL,”.nsf/”)
If sess.CurrentDatabase.Server=”" Then
sTempURL = Left$(sTempURL,8) & “/” & Mid$(sTempURL,iPosSlashUnderscores+3,iPosNSF-iPosSlashUnderscores-3) & Mid$(sTempURL,iPosNSF+4)
Else
sTempURL = Left$(sTempURL,iPosAT-1) & “/” & Mid$(sTempURL,iPosSlashUnderscores+3,iPosNSF-iPosSlashUnderscores-3) & Mid$(sTempURL,iPosNSF+4)
End If
sURL = sURL & sTempURL
Set doc = coll.GetNextDocument(doc)
If Not doc Is Nothing Then
sURL = sURL & Chr$(13)
End If
Wend
If sURL = “” Then
Messagebox “No Documents Selected”,0,”Nothing to do”
Else
Messagebox sURL,0,”URL(s) for selected docs”
End If
(also posted in http://www-10.lotus.com/ldd/nd6forum.nsf/ShowMyTopicsAllFlatweb/9324f9e90784fbd5852573be0071f311?OpenDocument)
Posted under Lotus Domino, Work Portfolio
This post was written by Marc
on December 31, 2007 at 1:49 pm

It’s too bad that they don’t actually tell you about this when you are, I don’t know, actually purchasing your computer!

