A handy undocumented Lotusscript NotesUIDocument method

Like many corporations we have a standard
signature that we encourage all our staff to use in their email. In versions
prior to release 8.5 there were two methods for signatures, a ‘Plain Text’
block of text or you could reference an external file like an image or
a bit of HTML. Although most email admins around the world would prefer
the plain text signature because it provides the most fedility when emailed
externally the folks in the marketing department designed the standard
signature making use of the corporate colors and styles so we created our
signature as a html file on the users machine by using the
Signature
Wizard
code provided by Rocky
and tying it into our corporate addressbook to lookup the information so
the end use didn’t have to enter in anything.

Now that Lotus Notes 8.5 is out the
way it handles signatures has changed. It is now a richtext field in the
users mailfile preferences we we decided to sit down and rethink the way
we get peoples signatures setup. We already have a couple of minor customizations
to the standard mail template so we decided on adding a button into the
users mail preferences that they could click and it would build the standard
signature and put it into the richtext field. The advantage of this solution
is that it would work across all platforms as Rocky’s original code only
seemed to work on Windows.

So what’s all this got to do with an
undocumented LotusScript call you ask? Well during the course of rewriting
the code I had hit into the bane of the Notes UI developer’s life, updating
a richtext field while working with a UIDocument that was on the screen.
if you have ever done any UIDoc work you will know that updating a richtext
field normally involves saving and closing the document and then reopening
it to get it to display the updated field. There are a couple of workarounds
but nothing that will give the end user that perfect UI experience like
reopening the mailfile preferences to the correct tab in the tabbed table.

While working on my solution I noticed
a method popping up on the autocomplete for the NotesUIDocument called
ImportItem. A quick look in the documentation revealed nothing, it is not
a documented method. I then scanned the mail template using one of my favorite
TeamStudio tools and found that IBM were using this method in the ‘ImportSignature’
agent in the mailfile. This agent is used to append the signature from
the mail preferences to whereever the cursor is in the body of an email.
What’s interesting is that it is a NotesUIDocument method that is updating
a richtext field ( the email body ) without having to do the whole save,
close and reopen.

A little experimenting and I had my
new signature code up and running. I created a temporary document in memory
with a single richtext field in it and then used the NotesRichText classes
to build the signature while looking up the information form the corporate
phonebook. Once the signature was built I used the NotesUIDocument methods
to get to the Signature_Rich field in the mailfile preferences, cleared
out everything that was already in that field and then called uidoc.importitem(tmpDoc,tmpRTField)
and bingo, the richtext that I had build in my temporary document appeared
in the richtext field in the users mailfile preferences. The end use can
now make any manual chances they want and then save their mailfile preferences.

Hopefully this undocumented method will
be of use to others, anywhere you need to update a richtext field on a
UIDocument you can build the richtext in a temporary place then use the
UIDocument to set the insertion field and point and call this method to
pop the richtext directly into the field without having to go through the
save, close and reopen workaround.

Tagged with: , ,
Posted in None

The Question I Forgot To Ask The Developers

There is nothing worse then leaving the
‘Ask the Developers’ session at Lotusphere and then thinking of a question
that you would have loved to have asked so I’m going to ask it here in
the hope that somebody might see it.

There was a lot of sessions on XPages
at Lotusphere this year, a lot of the development sessions concentrated
on XPages development for the web browser but there are still a lot of
people who develop for the Lotus Notes client or who like to create a good
client interface for applications that can be accessed via the web or the
Notes client. When version 8 was originally released it introduced a new
concept for the Notes Client called ‘Java Views’ which was added to a couple
of the standard templates like the mailfile and personal addressbook.

These new Java Views looked really great
but the ability for the non-IBM application developer to create these Java
Views was hidden from us but it was soon discovered that you could apply
the java views to your own applications by adding in a notes.ini variable
to expose some extra options in the Domino Designer client.

However if you d reuse the Java View
framework in your own applications you end up with the default switcher
in the upper right corner of the navigator. While it’s handy for your mailfile
it serves no purpose in custom applications. Starting in 8.5 you can now
disable the default switcher thanks to these
instructions
from Steve Castledine but what I’d love is a way
to create your own switcher options.

In Blogsphere and in many other applications
that I have created I like to ‘hide’ the configuration and logging navigators
behind the switcher as it creates a cleaner interface for the standard
user who does not need to see these areas of the application on a regular
basis. Using Java Views this is not possible however if I could program
the default switcher to my own needs then I’d be able to do it.

So my question for the ‘Ask the Developers’
session should have been, when will you release more information about
Java Views and allow us the ability to customize all aspects of Java Views
including the default switcher.

Tagged with: ,
Posted in Uncategorized

The Lotusphere Pledge

If you attended the 11 Commandments session at Lotusphere by Paul Mooney and Bill Buchan you may spot yourself in this video I took of everybody doing the pledge at the start of their session.

Tagged with:
Posted in Uncategorized

Lotusphere Tuesday Recap

The temperature has really dropped in Orlando,
I’ve even heard rumor that it is warmer in the UK then it is here although
it’s still pretty low in Pittsburgh and an email from our dog sitter said
that we got another foot of snow in the past few days so I won’t be complaining
too much.

My Tuesday started out with yet another
XPages session called XPages 101. This session was a great starter session
on some of the things that you can do with Xpages and how to start building
them and using them in your applications. I’ve been doing a lot of XPages
sessions as I can see where XPages can really make a difference in my organization
with the future development of web applications for our end users and customer
extranet.

After the session I headed on down to
the labs to talk to the XPages developers to clarify a few of the features.
In the lab down at the product showcase you can also sit down and go throught
an exercise to get you familiar with using XPages.

After lunch  headed to Bob Balaban
and Rocky Oliver’s session on Mythbusters where they talked about a few
of the different myths about Notes/Domino and gave their reasons and experiences
as to if the myth was true or false.

Then it was on to Lotusphere Idol to
watch the contestants get up on stage and give their 5 minute overview
of the session they wanted to give at Lotusphere while being brated by
the judges afterwards. There were two winners of Lotusphere Idol this year
and they will be given a halfhour session on Thursday. It was a fun session
to attend and the surprise contestant will mean I’ll never look at Locust’s
the same way again.

I then went to see Matt White’s session
on using the wrong Domino Designer elements to do the right thing. This
was an interesting session on hw to use Pages and forms to get domino classic
web apps to do fancy things with css and javascript.

After a quick break it was down to Speedgeeking.
We setup and the crowd flowed in, there was a good crowd and with about
20 sppedgeeking stations I ended up with about 5 or 6 listeners for each
of the 5 minutes that I was speaking. After an hour and a half and having
run through my session on building multilingual applications my voice was
starting to go. In all it was quite a good time and I certainly enjoyed
doing it.

Once everybody was out of there they
were all off to different parties but myself and Terri decided to take
the evening off and tke a nice walk around the boardwalk area before heading
back to our villa to put our feet up and relax with another day in the
can.

Tagged with:
Posted in Uncategorized
Archives