Project

General

Profile

About

The bean is compatible with Windows XP and superior, with Office 2003 and superior, 32 and 64-bit - Servoy 3.5.x and more.
It is not web compatible and will not work on Mac OS X or Linux either.

All the jars are signed using a proper certificate, meaning you can safely use them as-is on a production server.
Of course, you can also re-sign the jars using the SignTester tool

Installation

Simply unzip the installation package found in the Files section into your /application_server/ folder.

The structure of the zip is:

/beans/
/beans/dndoutlook.jar
/plugins/
/plugins/dndoutlook/
/plugins/dndoutlook/jacob.jar
/plugins/dndoutlook/msgparser-1.10.jar
/plugins/dndoutlook/tnef.jar
/plugins/dndoutlook_plugin.jar
/plugins/dndoutlook_plugin.jar.jnlp
/solutions/
/solutions/DnDOutlookSample.servoy

NB: Make sure to remove the dndfile.jar from your /beans/ to avoid any version conflict. If you don't the new bean will have trouble and will not work!
This will not break any solution that might be using the DnDFile bean since that bean is also contained in this distribution.

To try the bean after the installation, launch Servoy and import the DnDOutlookSample.servoy which should have been unzipped in your /application_server/solutions/ folder

Usage

The basic usage of the bean is the same as the DnDFile Bean, except that this one accepts email drag and drop from Outlook.
Meaning you can drop files from your windows explorer, urls from a browser and emails (with attachments) from Outlook.

New property and methods

A new designtime/runtime property has been added to the plugin, which allows to format how the emails will appear in the drop list.
This emailFormat property accepts a format in the accepted form used by the java.text.MessageFormat
The default value of the emailFormat property is "Email: {0} (from {1} on {2,date,yyyy-MM-dd HH:mm:ss})"
The emailFormat property accepts i18n values in the form i18n:yourkey

The object fed to the format are:
  • {0}: the subject of the email
  • {1}: the from value of the email
  • {2}: the receivedOn date the email, which can be further formatted using the {2,date,XXXXX} notation (see the comments in the API of the java.text.MessageFormat)

A new method has also been added to allow retrieving the list of email dropped (contained in the bean)
The method signature is:

Email[] getEmails() - this method will return an array of Email object
Email[] readEmailFiles(file(s)) - this method will return an array of Email object read from file(s), JSFile(s) or path(s)
addEmails(email(s)) - this method allows to programmatically add Email objects to the bean, simulating an onDrop (and also firing the onDrop method callback)

The Email object

An array of Email object is returned by the getEmails() method of the bean.

This object has the following methods:
  • File[] getAttachments() - returns an array of java.io.File, giving you access to further process them
  • Email[] getAttachedEmails() - for email generated from a msg file, returns an array of Email objects that might be contained
  • String getCcs() - return the CC value (if any)
  • String getFrom() - return the from value
  • String getHtml() - return the HTML content (if any)
  • String getRtf() - return the RTF content (if any) in case the email was generated from a msg file.
  • String getId() - return the Outlook internal UUID
  • int getImportance() - return the importance set on this email - 0 to 2
  • String getImportanceAsString() - return the importance set on this email, one of LOW, NORMAL or HIGH
  • String getRecipients() - return the recipients (field To:) of this email
  • Date getReceivedOn() - return the reception date/time
  • Date getSentOn() - return the sent date/time
  • String getSubject() - return the subject
  • String getText() - return the plain text content (if any)
  • boolean hasAttachments() - return true if the email has attachments
  • boolean hasHtml() - return true if the email has HTML content
  • boolean hasText() - return true if the email has plain text content
  • boolean hasRtf() - return true if the email has RTF content
  • boolean hasAttachedEmails() - return true if the email has attached emails
  • File getFile() - return the file this email was created from (or null if it was a drop from Outlook)

Additionally, the toString() method of the Email object will return the formatted summary of it (as set by the emailFormat value)

Event updgrade

The onDrop and onOmit bean event callbacks will receive an additional array of emails as their last parameters.

So the onDrop function callback should have this signature in your code:
function onDrop(files, urls, emails, exception) {...

And the onOmit function callback should have this signature in your code:
function onOmit(omitted, files, urls, emails) {...

See the sample solution for usage of these methods.

Security

You might have to allow java to access Outlook on the first drop of an email: this is a security issue which cannot be by-passed.
Typically a few DLLs will ask permission to access Outlook, and you should grant access and check the "always" checkbox when a window asking for your permission is displayed. This way, you will not have to do that on further use of the bean.
Make sure your users do the same, otherwise the drag-and-drop operations from Outlook will not be possible.