Blog

Alfresco and ECM

Previews of Outlook MSG files

dec 16 2010

Categories : Tips and Tricks

Here is a quick tip for getting previews if you store Microsoft Outlook msg format files in Alfresco Share. By default it creates no previews, but all it takes is a little configuration, supporting transformers are already in place.

Create a file in tomcat/shared/classes/alfresco/extension and name it msg-preview-context.xml, with content

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
   <!-- This transformer allows for the webpreviewing of outlook msg files. -->
   <bean id="transformer.complex.Msg2swf"
        class="org.alfresco.repo.content.transform.ComplexContentTransformer"
        parent="baseContentTransformer" >
      <property name="transformers">
         <list>
            <ref bean="transformer.OutlookMsg" />
            <ref bean="transformer.PdfBox.TextToPdf" />
            <ref bean="transformer.Pdf2swf" />
         </list>
      </property>
      <property name="intermediateMimetypes">
         <list>
            <value>text/plain</value>
            <value>application/pdf</value>
         </list>
      </property>
   </bean>
   <!-- This transformer is to support thumbnail previews -->
   <bean id="transformer.complex.Msg2image"
        class="org.alfresco.repo.content.transform.ComplexContentTransformer"
        parent="baseContentTransformer" >
      <property name="transformers">
         <list>
            <ref bean="transformer.OutlookMsg" />
            <ref bean="transformer.complex.Text.Image" />
         </list>
      </property>
      <property name="intermediateMimetypes">
         <list>
            <value>text/plain</value>
         </list>
      </property>
   </bean>
   <!-- This is only needed if you have trouble doing metadata extraction -->
   <bean id="extracter.Mail" class="org.alfresco.repo.content.metadata.MailMetadataExtracter" parent="baseMetadataExtracter" >
      <property name="supportedDateFormats">
         <list>
            <value>EEE, d MMM yyyy HH:mm:ss Z</value>
            <value>EEE, d MMM yy HH:mm:ss Z</value>
         </list>
      </property>
   </bean>  
</beans>

It will only create a preview based on the text format of the message, so unfortunately the html formatting (if present) will not be rendered.
In the configuration file I also added support for creating thumbnails.
I’ve added this as an enhancement request ALF-6200 so if it is accepted the config to will become part of standard Alfresco.

Depending on your locale settings you may need to add support for additional date formats in order for metadata extraction to work for msg files. That is the last part in the configuration file and may not be needed for your installation. Extract metadata can be done using rules, see Alfresco Share help The Document Library page component/Working with folders/Using rules.