Skip to content

Instantly share code, notes, and snippets.

@emmanuel-tissera-gs
Created August 13, 2015 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emmanuel-tissera-gs/19ec7fe4b9135398c45f to your computer and use it in GitHub Desktop.
Save emmanuel-tissera-gs/19ec7fe4b9135398c45f to your computer and use it in GitHub Desktop.
Synchronize Kentico Staging
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);
CMSWorkerQueue.RunCurrentQueuedWorkers();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment