Sample code for allowing drag-and-drop of Notes/Domino documents (including email) to a table in a plugin

Because I had to piece this together from examples on the Internet, and probably other people do too:

Transfer[] transferArray = new Transfer[]{
    transferArray, new DropTargetAdapter() {
        public void drop(DropTargetEvent event) {
            TableItem item = (TableItem) event.item;
            // You can access the object with item.getData()
            try {
                Session session = NotesFactory.createSessionWithFullAccess();
                if ( instanceof URIDescriptor[]){ 
                    URIDescriptor[] droppedURL = (URIDescriptor[]);
                    for (int i = 0; i < droppedURL.length; i++) { 
                        URI uri = ((URIDescriptor) droppedURL[i]).uri;
                        Document d = (Document) session.resolve(uri.toString());
                        // Do things with the document
            } catch (Exception e) {
            } finally {

Use session.resolve instead of db.getDocumentByURL to retrieve a document from a plugin, as both session.getAgentContext() and session.getCurrentDatabase() will return null.

  • Hi Sacha,

    Thank you for sharing this code, this showed me some light in the dark path of drag and drop fom Lotus to java app…

    I need to build a system where users should be able to drag and drop emails from lotus noes client, and the dropped document should get saved in some other database as dxl file.
    Again when user double click the mails in the second system it should get open in lotus client again.

    do you have any clue on that? I know how to generate DXL and parsing DXL…….
    I am seeking for any clue how the other system get the handle of the dropped mail document…

    thanking you in advance…..

    Samrat Roy

  • C LEE

    Thank you for your sharing but I am sorry to say that I still cannot understand the full picture on how it works because I am new in Lotus Expeditor and Eclipse SWT. I would like to know is it possible to do drag and drop in Lotus Notes in this way: Drag an email to the lotus notes sidebar (the sidebar shows folder hierarchy). When the email is dragged to the specific folder, the email will be saved to that particular directory.

    Thank you very much.

    C LEE