This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using CMS.Base; | |
using CMS.IO; | |
using CMS.MediaLibrary; | |
using CMS.Membership; | |
using System; | |
namespace KenticoMediaLibraryConsole | |
{ | |
internal class Program | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration> | |
<connectionStrings> | |
<clear /> | |
<add name="CMSConnectionString" connectionString="..." /> | |
</connectionStrings> | |
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void AddMediaLibraryItem() | |
{ | |
CMS.Base.SystemContext.WebApplicationPhysicalPath = @"D:\inetpub\wwwroot\Site\CMS"; | |
CMS.DataEngine.CMSApplication.Init(); | |
var libraryName = DateTime.Now.ToString("yyyyMMdd-HHmm"); | |
var library = CreateMediaLibrary(libraryName); | |
var mediaFile = GetInitializedMediaFile(library); | |
if (mediaFile != null) | |
{ | |
MediaFileInfoProvider.SetMediaFileInfo(mediaFile); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void IncludeDependentAssemblies() | |
{ | |
CMS.FileSystemStorage.Directory directory = new CMS.FileSystemStorage.Directory(); | |
CMS.DataProviderSQL.TableManager tableManager = new CMS.DataProviderSQL.TableManager(); | |
} |