dominoGuru.com
Your Development & Design Resource
Installing local replica Lotus Notes Applications via Email
11/18/2009 12:15 AM by Chris Toohey
I recently ran into a scenario where a customer site - which did not have a Lotus Domino Policy architecture that supported this - had a need to deploy a two local replica Lotus Notes Applications to remote users.
The trick here was that they wanted this automated. Nope, couldn't tell the user to File\Open..., select the desired Lotus Notes Applications, and create local replicas as needed. Not only didn't they want to task their support desk with the chore of walking their remote users through such an exercise, but they quite frankly knew that asking this remote team to walk through even the most detailed directions would result in a flood of calls to the support desk.
So it was up to me, the code poet who slung together the local replica Lotus Notes Applications in question, to come up with a way to make this process as seamless as possible.
It's with that task in mind that I came up with the following solution: a method of installing local replica Lotus Notes Applications via email.
The synopsis:
While I deployed this solution via the whitehat Lotus Notes virus technique that I talked about recently, I'll cover a scenario that most of us are familiar with: the creation of a button in an email message sent to a given recipient.
I will create local replica stubs for each Lotus Notes Application that I plan to install, attach those stubs to my email, and create a simple LotusScript-based button in the body of said email message that will perform the installation/detachment and replication of each stub.
Local Replica stubs:
This is the easiest part of a pretty easy tutorial. You'll be creating a replica stub - that is, a NotesDatabase replica that has none of the Design Elements or NotesDocuments, but rather only contains NotesDatabase Properties (Title, ReplicaID, etc.) and Access Control List information. The replica stub is an actual Lotus Notes Application, of course, and is approximately 360KB in size. The good news is that this is easy:
By de-selecting the Create Immediately Flag from the Create Local Replica dialog prompt, you will be creating a replica stub of the given Lotus Notes Application!
Yep, it's that simple.
Now I'll create new replica stubs for every Lotus Notes Application that I need to deploy, and will be attaching these stubs in the body of a new email message. Due to the relatively small filesize, putting two or three of these into your deployment email message is a non-event - even if you're routing this email to groups of individuals.
The next step is to create a LotusScript Button in that new email message body and code the button to detach all attached replica stubs to the Lotus Notes Client NotesData directory!
Email Body Button LotusScript:
Sub Click(Source As Button)
Dim s As New NotesSession
Dim w As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim body As Variant
Dim ini_dir As String
Dim xdb As NotesDatabase
Dim sdir as String
ini_dir = s.GetEnvironmentString("Directory", True)
sdir = ""
Print "Detaching and Replicating Stubs..."
Set uidoc = w.CurrentDocument
Set doc = uidoc.Document
Set body = doc.GetFirstItem("body")
If ( body.Type = RICHTEXT ) Then
Forall o In body.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
Call o.ExtractFile( ini_dir + "\" + sdir + o.Name )
Set xdb = s.GetDatabase("",sdir + o.Name)
If (xdb.IsOpen) Then
Call xdb.Replicate(s.CurrentDatabase.Server)
End If
End If
End Forall
End If
Print "Stubs Successfully Replicated - Installation Complete!"
End Sub
And that's it! This script detaches each Lotus Notes Application replica stub to the Lotus Notes Client NotesData directory, and post-detach replicates each stub to the Domino server.
Conclusion & Considerations:
If you are doing a bunch of these things, you might want to opt for storage of the Lotus Notes Application replica stubs on a network share. It changes the deployment code (obviously), but the same idea would hold up -- which is to detach each replica stub to the Lotus Notes Client NotesData directory and perform a Domino server replication.
You could even opt for an xCopy to copy these Lotus Notes Application replica stubs from a commonly accessible network drive to the Lotus Notes Client NotesData directory!
You will also notice a few ready-to-modify parameters, such as the
sdir
String, which you can use to put the Lotus Notes Application
replica stubs in subdirectories off of the Lotus Notes Client NotesData
directory.
The above code, incidentally, has the Lotus Notes Application replica stubs replicating with -- if you follow the code -- the current Domino Server. Since this function is executing from the user's Mail Database, this will either be the Mail server or (in the case of the user reading their email in the local replica of their Mail Database) Local. Obviously, you'll want to modify this to meet your specific environment.
So, to sum up: This technique will allow you to quickly deploy Lotus Notes Applications that require local replicas. It's simple code that's an easy-to-implement and reusable. Hopefully if you find yourself in a similar need, this technique -- if not this exact code -- will get the job done for you!