For years I’ve been meaning to mod the DWA Redirector database design to let the user choose from a list of user names instead of requiring them to type the name of the mailfile they wish to open if not their own. I’ve searched the sandbox and openntf and not found this, so today I finally cobbled something together that consists of adding one form and two fields to the default design of the iwaredir.ntf template. Here’s how I did it:
First, I wrote a webqueryopen agent that retrieves the list of names from the user’s mailfile:
Dim s As New NotesSession
Dim db As NotesDatabase
Dim nab As NotesDatabase
Dim v As NotesView
Dim persondoc As NotesDocument
Dim doc As NotesDocument
Dim mailfile As NotesDatabase
Dim calprofile As NotesDocument
Set db = s.CurrentDatabase
Set doc = s.DocumentContext
Set nab = New NotesDatabase(db.Server, "names.nsf")
Set v = nab.GetView("($Users)")
Set persondoc = v.GetDocumentByKey(s.EffectiveUserName)
Set mailfile = New notesdatabase(db.Server, persondoc.mailfile(0))
Set calprofile = mailfile.GetProfileDocument("CalendarProfile")
If calprofile Is Nothing Then Msgbox "Couldn't get calprofile"
doc.ManageCalendarFor = calprofile.ManageCalendarFor
This agent must have its “Run as web user” property enabled.
Then, to present the list in the WMRProfile form:
-
I added a multi-value, computed for display, hidden text field at the top (I put mine below the break tag and above the WMRDebugHeader subform) called ManageCalendarFor, with a computed formula of @thisvalue.
-
I replaced the existing WMRDelegate field with an editable combobox that has the same default value formula, and a computed formula for choices of:
@Name([CN]; @Trim(@UserName : ManageCalendarFor))
-
I removed the text “, if other than your own” from the label above the field.
-
I put the name of my webqueryopen agent in the form’s webqueryopen event formula.
DISCLAIMER:
Note the lack of error handling code (or logic) in the agent. It is written to assume that the user’s mailfile is located on the same server as the DWA redirector db, and with an identical path to the one on the user’s home server. And I have just tossed this together now, with absolutely no significant testing or use in a production environment.
Anyone who wants to do anything better with this idea is more than welcome to, and if you credit me for my contribution, then that’d be swell. If you don’t, I won’t cry. And of course, feel free to post any problems you find as responses to this posting.