dominoGuru.com
Your Development & Design Resource
Using Notes URLs to open XPages, Forms, Framesets and more in the Lotus Notes Client
03/02/2010 12:15 PM by Chris Toohey
You can set an XPage Design Element as the Default Launch Object of a NotesDatabase, but I was asked recently if there is a way that you could launch an XPage (in the Lotus Notes Client) via a direct call - such as from an Email, an intranet URL, or another like-context.
I happen to use Notes URLs to call an XPage in the Lotus Notes Client, but before you jump in there are several things you should know...
Understanding the Notes URL
The syntax is simple enough:
Notes://Server/NotesDatabase Path
This isn't some new technique mind you, as I discussed Lotus Notes Client URLs back in 2003, but I do find that it's a forgotten yet extremely powerful method for calling Lotus Notes Client Design Elements and launching them in the Lotus Notes Client.
As you can see in the aforementioned post from 2003, you can substitute the NotesDatabase Replica ID for the NotesDatabase Path in the above syntax and it works just as well. In fact, using this method allows you to place the local replica in any subdirectory without fear of losing the handle, and is thus my preferred method.
Building your Notes URL
Notes URLs are absolute URLs, and are not relative to the current context (active NotesDatabase, Website, etc.), and thus need the complete URL.
You can use Notes URLs for intra-NotesDatabase navigation. You'll just need to create the absolute URL dynamically from the current context!
We'll start off with a very vanilla Notes URL:
Formula:
"notes://" + @Name([CN]; @Subset(@DbName; 1)) + "/" + @Text(@ReplaceSubString(@ReplicaID; ":";""))
LotusScript
Function notesurl(db As NotesDatabase) As String Dim sname As New NotesName(db.Server) notesurl = |notes://| + sname.Common + |/| + CStr(db.Replicaid) End FunctionThis LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.
Simple enough, really. And adding an XPage to the URL is as simple as appenending the name of your target XPage Design Element to the Notes URL syntax:
Notes://Server/ReplicaID/XPage Design
Element
Conclusion
Now that you have your Notes URL, you can use it anywhere you can use a standard HTTP URL, and launch NotesDatabases, Forms, FrameSets, and even XPages in the Lotus Notes Client!
From that 2003 post, I created a simple Notes URL that launched the Personal Address Book or even create a new Contact. Originating the Notes URL call from within Lotus Notes via Formula or LotusScript gives you even more options.
... and it doesn't stop with a simple Form or UI XPage launch in the Lotus Notes Client. Remember, there's nothing keeping you from adding LotusScript or Java to the PostOpen Event of your target Form Design Element or leveraging SSJS via XPage XAgents... all from a simple Notes URL call!