ECL Import UI eXtension

SDL Tridion 2013 comes with a new feature, External Content Library (ECL), which is a module for exposing multimedia contained in an external system in SDL Tridion so that you can use the media in SDL Tridion-driven Web sites.

While ECL items are perfectly fine to use in your web content and this most of the time is exactly what you want, you could also think about using ECL to import content in your CMS. Either your external multimedia content is stored in a non permanent location (think about Dropbox) or you just want to make a one time import of the items to have them stored in your SDL Tridion CMS. Expecially for this we (Frank van Puffelen and Bart Koopman) created a UI extension to show how relatively simple this could be done. The extension is created for both the Content Manager Explorer (CME) interface as well as the Experience Manager (XPM aka. SiteEdit).

The content is imported from the ECL item by either calling GetContent or reading the content from the location specified by the GetDirectLinkToPublished method. It is designed as a completey working example to show how ECL items can be dealt with in UI extensions and comes complete with all source code so you can see how it is all done. Feel free to take it apart completely or reuse as a basis for your own ECL TBBs. The source is available in the download package below and also on Google code as an open source project.

In the CME, you can (after installation) right click on any ECL item to import its content into a Multimedia Component. You can also execute this action on an ECL folder, which will import all its ECL items. After selecting the action from the context menu, you get a pop-up window where you can specify the location of where you want the Multimedia Component to be created. The Multimedia Schema used for the import is configured in the configuration file of the (editor) extension.

import item   select location

In the Experience Manager view, the flow is implemented a bit differently. ECL items which are used on a Page (or in a Component, Multimedia link) can be "replaced" by selecting the item and then choosing the import multimedia content Start button from the properties.

xpm start import

This will change the tree view on the left into an area where you can select the target location for your import action (i.e. the location where to create your Multimedia Component). Then you select the green Import button, which will create a new Multimedia Component in the selected location. After it has been successfully imported, the link to the ECL item on your Page (or Component) will be replaced by the newly created Multimedia Component.

xpm import

Because the extension comes with full code and works on the CME as well as the XPM view, it can also act as an example for other scenarios. The UI part consists of a so called Editor extension and the actual import is done using the SDL Tridion Core Service in a Model extension. It will also import External Metadata from the ECL item provided the configured Multimedia Schema contains a multi value Metadata field named 'data' (consisting of an Embeddable Schema with 'key' and 'value' fields). In the Configuration folder of the Editor, an Embeddable Schema is provided which can be used for the 'data' Metadata field.

Installation

This eXtension comes with full source as a Microsoft Visual Studio solution which you can directly compile and deploy (you can use the free Microsoft Visual Studio Express edition). The Editor and Model projects have a deploy batch file in the root which is used to copy the required files to your CMS server. For more details, follow the installation process as described in the Example UI extension (the Model extension is installed the same way, but then under ..\WebUI\Models).

In the EclImportEditor.config file the item id of the Multimedia Schema to use for imported content and item id of the target Folder for imports can be configured (keep in mind that for the XPM import to work, the Multimedia Link field has to allow both the ECL schema and the configured Multimedia Schema).

Background information

More information about ECL and how to create ECL providers can be found in the SDL Tridion documentation:

  1. Developing a Provider (ECL) (login required)
  2. External Content Library concepts and API (login required)
  3. ECL Template Building Block
  4. ECL Event Handler
  5. Flickr ECL provider
  6. YouTube ECL provider

Developer
:    Bart Koopman
Company
License agreement
Download package
Tags
:    import,  2013,  ECL,  XPM
Version
:   1.0
Source
:   Yes

About the Author
Bart Koopman
Community Development Consultant

As a Community Development Consultant, Bart is the evangelist of all SDL Tridion products. Bart used to be a consultant and trainer at SDL Tridion, supporting both partners and customers with their implementations.

SDL CMT division
About the Author
Frank van Puffelen
Technical Director

Frank joined SDL in 2004 and as a principal developer worked on many of the company's releases until the end of 2012. He is now the technical director of ZyLAB USA.

ZyLAB