Downloading the media library folder
Sitecore provides you with the facility to download individual files from the Content Editor. Sometimes, content authors might need to download the whole media library or media files of any selected folders in a ZIP file. In this recipe, you will learn how to use Sitecore APIs to download the whole media library folder along with media metadata.
How to do it…
We will first create a Command
class to download the media library folder:
- In the
SitecoreCookbook
project, create a newDownloadMediaLibraryFolder
class in theCommands
folder and inherit it from theCommand
class. - Override the
Execute()
method of the class as follows:public override void Execute(CommandContext context) { if (context.Items.Length == 1) { ...
Get Sitecore Cookbook for Developers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.