Make the NotesURL property usable

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.





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
    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)
        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
If sURL = “” Then
    Messagebox “No Documents Selected”,0,”Nothing to do”
    Messagebox sURL,0,”URL(s) for selected docs”
End If

(also posted in

Posted under Lotus Domino, Work Portfolio

This post was written by Marc
on December 31, 2007 at 1:49 pm


3 Comments so far

  1. Hans Holt December 6, 2008 4:10 pm

    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.

    Hans Holt

  2. Marc December 6, 2008 6:00 pm

    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.

  3. Serhii Riabovil February 22, 2012 10:09 am

    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 & _

    End Function

Leave a Comment

Name (required)

Email (required)



More Blog Posts

Previous Post: