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)
You do not even need the servername – just use notes:///85256EDA00695075/0/EEF8D00A7E50A458852573BE0069A402?
All Notes links do not realy use the servername – If you have a replica on another server it might as well be accessed.
Regards,
Hans Holt
Thanks Hans, I’ll have to give that a try. I thought that, if you did not have a replica on your workspace, it would come back and prompt you for the server.
It’s easier to generate notesurl than parse that awkward NotesDocument.NotesURL
Function KosherNotesURL(doc As NotesDocument) As String
Dim nnServer As NotesName
Set nnServer = New NotesName (doc.ParentDatabase.Server)
KosherNotesURL = “notes://” & _
nnServer.Common & “/” & _
doc.ParentDatabase.ReplicaID & “/0/” & _
doc.UniversalID & _
“?OpenDocument”
End Function