kentico_radekm
-
8/9/2010 4:34:47 AM
RE:Importing Images into the Media Library using code
Hello.
Yes, it is possible to do it via API. You will need to write common ASP.NET script to load content of your media library´s folder and use our API to import it into database.
First, you will need to create MediaFileInfo object (in CMS.MediaLibrary class) and fill all required properties (fileName, filePath, fileExtension, etc.). Then you need to import it via ImportMediaFileInfo(MediaFileInfo) method, which import media file into database. The method is in CMS.MediaLibrary.MediaFileInfoProvider class. You can do it in cycle, so for every item in your folder, you will create appropriate object and import it. You can see more details about mentioned methods in our API reference file.
Best Regards, Radek Macalik
|