using the kentico cms api l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Using the Kentico CMS API PowerPoint Presentation
Download Presentation
Using the Kentico CMS API

Loading in 2 Seconds...

play fullscreen
1 / 15

Using the Kentico CMS API - PowerPoint PPT Presentation


  • 137 Views
  • Uploaded on

Using the Kentico CMS API. Thom Robbins (thomasr@kentico.com Bryan Soltis (bryan@bitwizards.com). Agenda. Overview (Architecture/Objects) (Thom) CMS Context (Bryan) Document Management (Thom) Global Events (Thom) Modules (Bryan). Looking at Kentico CMS.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Using the Kentico CMS API' - ryo


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
using the kentico cms api

Using the Kentico CMS API

Thom Robbins (thomasr@kentico.com

Bryan Soltis (bryan@bitwizards.com)

agenda
Agenda
  • Overview (Architecture/Objects) (Thom)
  • CMS Context (Bryan)
  • Document Management (Thom)
  • Global Events (Thom)
  • Modules (Bryan)
looking at kentico cms
Looking at Kentico CMS

Logical three tier architecture…

architecture breakdown
Architecture breakdown
  • Presentation layer
  • Best Practice Tip
  • Kentico CMS web site project provides examples of all sorts of code!
oo basics object creation examples
OO Basics - Object Creation Examples

// Create UserInfo

CMS.SiteProvider.UserInfo user = new CMS.SiteProvider.UserInfo();

// Set properties

user.UserName = "Alice";

user.FirstName = "Alice";

user.LastName = "Cooper";

user.FullName = "Alice Cooper";

user.Email = "alice.cooper@domain.com";

user.IsEditor = true;

user.IsGlobalAdministrator = true;

user.PreferredCultureCode = "en-us";

user.Enabled = true;

// Create new user

CMS.SiteProvider.UserInfoProvider.SetUserInfo(user);

  • Example - Creating new user

// Prepare the TreeProvider (it must be initialized with user information when editing document structure)

UserInfoui = UserInfoProvider.GetUserInfo("administrator");

CMS.TreeEngine.TreeProvider tree = new CMS.TreeEngine.TreeProvider(ui);

// Get the document (current culture)

CMS.TreeEngine.TreeNode node = tree.SelectSingleNode(CMS.CMSHelper.CMSContext.CurrentSiteName, "/News/TestingWorkflow", CMS.CMSHelper.CMSContext.CurrentUser.PreferredCultureCode, false, null, false);

if (node != null)

{

// Always delete the document with DocumentHelper, it handles all the dependencies

CMS.WorkflowEngine.DocumentHelper.DeleteDocument(node, tree, true, true,true);

}

Example – Delete Document

api everywhere
API Everywhere!

Some Examples…

  • Class View is your Friend

Best practice Tip:

Class view is customizable to allow personalized organization and viewing

helpers and general libraries
Helpers and general libraries
  • Best Practice Tip
  • For general code locate the appropriate helper and use it
  • If the helper contains similar methods override and extend
  • Implement new behavior in helpers
cms context
CMS Context
  • CMS.CMSHelper.CMSContext class provides static methods to access common information

Need a code snippet?

document management how documents are stored
Document Management – How documents are stored
  • Documents stored in SQL joined tables
    • CMS_Tree – Table with basic document data shared between different language versions. Contains one record for all culture version of the document
    • CMS_Document – Table with document data of specified language version of the document. Contains one record representing one language version of the document
    • Coupled table – table that contains custom document type fields

Best Practice Tip:

Every document is stored in up to three (3) tables. Use the API to access documents

document management versioning internals
Document Management – Versioning Internals
  • Document versions and its history are stored in separate tables
    • CMS_VersionHistory – Table containing the document versions. Each version of the document is represented by one record that contains the complete document data in XML.
    • CMS_AttachmentHistory – Table containing the attachment version records. Each attachment version is bound to one or more document versions. Every record contains binary data of the attachment.
    • CMS_VersionAttachment – Table containing the bindings of the attachment versions to the document versions.
document management techniques
Document Management Techniques

Best Practice Tip:

CMS.WorkflowEngine.DocumentHelper is recommended to access document information

CMS.CMSHelper.TreeHelper allows access to documents directly

Best Practice Tip:

TreeHelper.GetDocuments checks the view mode and then calls either TreeProvider or DocumentHelper

global events
Global Events
  • Provide a way to execute custom events within the CMS system
  • Managed as a separate projects
  • Web Config Key

Best Practice Tip:

Developer documentation contains step by step instructions for implementing Global Events

global event classes
Global Event Classes

Best Practice Tip:

For Document events always use either the CustomTreeNodeHandler (no workflow) or CustomWorkFlowHandler (workflow) not the CustomDataHandler

modules
Modules
  • Extend the CMS system to include your custom code
additional information
Additional Information
  • Best samples are in your project!
  • Get your poster
  • Documentation - http://devnet.kentico.com/Documentation.aspx
  • Code Snippet Library - http://devnet.kentico.com/Blogs/Thomas-Robbins.aspx
  • Marketplace - http://devnet.kentico.com/Marketplace.aspx