Skip to main content
    Country/region select      Terms of use
     Home      Products      Services & solutions      Support & downloads      My account     

developerWorks  >  Lotus  >  Forums & community  >  Best Practice Makes Perfect

Best Practice Makes Perfect

A collaboration with Domino developers about how to do it and how to get it right in Domino

I was reminded today about a misconception I've run across among Domino developers, and I thought it would be a good thing to mention here. It's quite natural to assume that in a Querypaste event of a view, you can use NotesUIView.Documents to get a list of the documents being pasted.

Nay nay!

This only appears to work because often people only test the Querypaste event by copying and then immediately pasting documents in the same view. During this event, the Documents property actually contains a list of the documents selected in the view -- not the documents being pasted. So it's no use in catching documents pasted from other applications to make sure they're using a known form, for instance. You can only look at specific pasted documents after they have been pasted (use Postpaste or an agent set to run on pasted documents). By then, of course, it's too late to do anything about them unless you have access both to read them, and to make whatever corrections might need to be made (edit/delete docs).

What? Wait! You can paste a document you don't have read access to? How? This happens when there's a Readers field in it that doesn't list you by name, but by role or group, and your roles and groups at your destination are different than in the source. It's a problem even if you have Manager access to the destination database -- if the Readers item doesn't list you, you can't see the document not nohow, including in the Postpaste event or agent.

It would, of course, be nice to be able to mess with the document's items (to make sure the user could still read or edit the document later) before they are written to disk. It also would help to get a chance to decide whether to allow the paste based on the contents being pasted.

Alas, there's no way to do this with LotusScript. I suppose it could be done using the Notes C API, by registering event hooks (EMRegister) -- though I haven't tried. This is tricky to do as part of an NSF design -- you'd need to install a DLL (or your OS' equivalent) on people's workstations.

Your best bet in most cases is to just turn pasting off (Continue = False) and provide view actions to do any "approved" types of document copying.

Andre Guirard | 10 January 2008 01:46:14 PM ET | Plymouth, MN, USA | Comments (5)

Search this blog 


    About IBM Privacy Contact