# DAM libraries

## Overview

A digital asset management (DAM) system helps you store, share, and organize all your digital content in a centralized location.\
Sitefinity CMS supports integration with the following DAM systems:

* Cloudinary (Progress.Sitefinity.Libraries.Cloudinary)
* Frontify (Progress.Sitefinity.Libraries.Frontify)

To use these DAM systems, you have to install the corresponding NuGet package first. For more information, see [Nuget.org](https://www.nuget.org/).\
In addition, you can integrate with another DAM provider by leveraging the newly added extension points. For more information, see [Custom DAM provider and thumbnails](https://www.progress.com/documentation/sitefinity-cms/custom-dam-provider-and-thumbnails).\
With these integrations, you use your digital content directly from your DAM system in your content blocks and related media fields, no files are stored in Sitefinity CMS.

> info  **NOTE**: Sitefinity CMS can work with only one DAM system at a time. In case multiple providers are configured and all of them are enabled, only the first one in the list will be used. To start working with a different DAM provider, all other DAM providers must be **disabled**. 

## Web security module configuration

If you upgrade to version 14.1 from a lower version and have the Web security module enabled, you must configure it to allow Frontify and Cloudinray domains.

1. Navigate to *Administration » Settings » Web Security*.
2. On *Trusted sources* click *Edit*.
3. In *Scripts* text area add `unpkg.com/@frontify/` or `*.cloudinary.com` depending on your DAM provider.\
   If you want to add multiple sources, use separate lines for each provider.
4. Expand *Fonts, images, video and audio* section.
5. In *Images* text area add `*.frontify.com` or `*.cloudinary.com` depending on your DAM provider.\
   If you want to add multiple sources, use separate lines for each provider.
6. In *Video and audio text* area add `*.frontify.com` or `*.cloudinary.com` depending on your DAM provider.\
   If you want to add multiple sources, use separate lines for each provider.
7. Expand *Forms, frames, child sources, connect sources, plugins* section.
8. In *Child sources* text area add `*.frontify.com`or `cloudinary.com` and `*.cloudinary.com` depending on your DAM provider.\
   If you want to add multiple sources, use separate lines for each provider.
9. In *Connect sources* text area add `*.frontify.com` or `*.cloudinary.com` depending on your DAM provider.\
   If you want to add multiple sources, use separate lines for each provider.
10. Click *Done*.

## Migrate media libraries to your DAM provider

If your media content is stored in Sitefinity CMS, you have the option to migrate it to your DAM provider. For this purpose, perform the following:

1. Download `Progress.Sitefinity.Libraries.DamMigration` NuGet package from [Nuget.org](https://www.nuget.org/) and install the package in your Sitefinity project.
2. Implement `IDamUploader` interface using a class that is specific for your DAM provider.\
   An instance of this class will be used by the `DamMigrator` class to upload the media files from Sitefinity CMS to your DAM provider.

   > info  **NOTE**: `IDamUploader` interface is also distributed with `Progress.Sitefinity.Libraries.DamMigration` NuGet package. You can find a sample implementation for Frontify on Sitefinity GitHub repository » [DAM migration sample](https://github.com/Sitefinity/dam-migration-sample) » [FrontifyUploader](https://github.com/Sitefinity/dam-migration-sample/tree/master/FrontifyUploader).
3. To start a migration of a media library, call static `StartMigrationTask` method from the `DamMigrator` class.  The method schedules a task to execute the migration and returns the ID of the scheduled task. It accepts the following four parameters:

   * `uploader` – an instance of the class that implements IDamUploader interface
   * `libraryType` – the type of the library that will be migrated
   * `libraryId` – the ID of the library that will be migrated
   * `providerName` – the name of the storage provider of the library

   Before scheduling a task, `StartMigrationTask` performs some validations and if any of them fails, the following exception occurs:

   * `Exception` – when there is no enabled DAM provider
   * `NotSupportedException` – when the libraryType is not supported by the DAM provider
   * `ItemNotFoundException` – when the method cannot find a library to migrate

   > info  **NOTE**: The migration task moves media content items from one library at a time.\
   > During the process of migration, the existing media content items will be moved to a new library in Sitefinity CMS, but their IDs will remain unchanged so existing relations between the media items and any other content will be preserved. The files of the media items though will be moved to your DAM provider and will no longer be managed by Sitefinity CMS. The new library is the same one, which is used when importing assets from the DAM provider - it is not visible on Sitefinity CMS backend UI and you cannot upload or delete items from it.
4. You can monitor the progress of the migration task in your Sitefinity CMS backend by navigating to *Content* » *Images* / *Videos* / *Documents & Files*. In case the migration fails to move any of the media content items for some reason, they will remain in the source folder, and you will be able to run the task again by clicking *Retry*. As an alternative, you can navigate to *Administration* » *Scheduled tasks* and from the *Actions* menu of the failed task, click *Retry*.

### Sample implementation

You can find a sample implementation for Frontify and details about how the migration works on Sitefinity GitHub repository » [DAM migration sample](https://github.com/Sitefinity/dam-migration-sample). A sample code snippet of migrating an image library to Frontify is also provided - see the [README.md](https://github.com/Sitefinity/dam-migration-sample/blob/master/README.md) file in this repository.
