Skip to content

Instantly share code, notes, and snippets.

Avatar

Emmanuel Tissera emmanuel-tissera-gs

View GitHub Profile
@emmanuel-tissera-gs
emmanuel-tissera-gs / program.cs
Last active Aug 29, 2015
Insert media files into Kentico Media Library
View program.cs
using CMS.Base;
using CMS.IO;
using CMS.MediaLibrary;
using CMS.Membership;
using System;
namespace KenticoMediaLibraryConsole
{
internal class Program
{
@emmanuel-tissera-gs
emmanuel-tissera-gs / app.xml
Created Aug 13, 2015
Essential Configurations
View app.xml
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<clear />
<add name="CMSConnectionString" connectionString="..." />
</connectionStrings>
</configuration>
View StagingSynchronization.cs
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);
@emmanuel-tissera-gs
emmanuel-tissera-gs / IncludeDependentAssemblies.cs
Created Aug 13, 2015
Include dependent Kentico assemblies
View IncludeDependentAssemblies.cs
private static void IncludeDependentAssemblies()
{
CMS.FileSystemStorage.Directory directory = new CMS.FileSystemStorage.Directory();
CMS.DataProviderSQL.TableManager tableManager = new CMS.DataProviderSQL.TableManager();
}