SlideShare a Scribd company logo
1 of 15
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
Logical three tier architecture…
Architecture breakdown
Data layer
(+metadata)
Business layer
Controls libraries
UI components
Web project pages Live site pages +
admin UI pages
Web parts + User
controls
CMSControls
Helpers
SettingsProvider
Enumerations Infos & Providers
Data engine
GeneralConnection
Abstract info
Metadata infos
(Class, Query,
SettingsKey)
Interfaces
Third party code
Module web parts
+ Module user
controls
Module controls
Module Infos &
Providers
Module definitions
Presentationlayer
Best Practice Tip
• Kentico CMS web site project provides examples of all sorts of code!
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);
// Prepare the TreeProvider (it must be initialized with user information when editing
document structure)
UserInfo ui = 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 - Creating
new user
Example – Delete
Document
API Everywhere!
• Class View is your Friend
CMS.SettingsProvider
.SettingsHelper
.SQLHelperClass
.TranslationHelp
er
CMS.GlobalHelper
.DataHelper
.ContextHelper
.AJAXHelper
Library Specific
CMS.Controls.CM
SControlsHelper
CMS.WorkflowEn
gine.DocumentHe
lper
CMS.Blogs.BlogHe
lper
Some Examples…
Best practice Tip:
Class view is customizable to allow
personalized organization and viewing
Helpers and general libraries
SettingsProvider
(metadata helpers)
SettingsHelper
(web.config)
SettingsKeyHelper
(web site settings)
SqlHelperClass
(low level DB connection, used
only from SettingsProvider)
DataHelper
(basic data manipulation)
TranslationHelper
(conversion of IDs based on
code names or GUIDs)
GlobalHelper
(general helpers)
/Context
(HTTP context related data)
/Data
(advanced data manipulation and
validation)
/Globalization
(resource strings and cultures)
/Markup
(macros, HTML, XML, text, script)
/Media
(images and media manipulation
and information)
Library specific
(module helpers)
ControlsHelper
CMSControlsHelper
DocumentHelper
WebFarmSyncHelperClass
Etc.
App_Code
(helper functions)
Functions.cs
InstallerFunctions.cs
BlogFunctions.cs
EcommerceFunctions.cs
Etc.
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.CMSHelper.CMSContext class provides static
methods to access common information
Method
CurrentAliasPath
CurrentDocument
CurrentPageInfo
CurrentSite
CurrentSiteName
CurrentUser
ViewMode
ResolveCurrentPath
Need a code snippet?
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
CMS_Tree
CMS_Document Coupled table
CMS_Document Coupled table
CMS_Document Coupled table
Best Practice Tip:
Every document is stored in up to three (3) tables. Use the
API to access documents
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.
CMS_VersionHistory
CMS_VersionAttachment
CMS_AttachmentHistory
Version of attachments
CMS_VersionAttachment
CMS_AttachmentHistory
Version of attachments
Document Management Techniques
CMS.TreeEngine.TreeNode
• Not aware of
versioning/workflow/attachments
• Only works with published records
CMS.WorkflowEngine.DocumentHelper
• Versioning/workflow/attachment aware
• Use for all document deletes
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
• 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
• The events are applied to all data items that are stored to the database. It
includes documents, user information or any other settings
• Receives DataClass
CustomDataHandler.cs
• Event applied to all exceptions that occur
• Receives System.exception
CustomExceptionHandler.cs
• Allows the integration of external databases and modify the authentication
and authorization processCustomSecurityHandler.cs
• Execute custom actions when a document is created, updated or deletedCustomTreeNodeHandler.cs
• Event applied to workflow documents (same as CustomTreeNodeHandler)
• Same as CustomtreeNodeHandler
CustomWorkflowHandler.cs
Best Practice Tip:
For Document events always use either the CustomTreeNodeHandler (no workflow) or
CustomWorkFlowHandler (workflow) not the CustomDataHandler
Modules
• Extend the CMS system to include your custom code
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

More Related Content

What's hot

What's hot (20)

클라우드 허브: 멀티클라우드 시대의 디지털 비즈니스 핵심 전략
클라우드 허브: 멀티클라우드 시대의 디지털 비즈니스 핵심 전략클라우드 허브: 멀티클라우드 시대의 디지털 비즈니스 핵심 전략
클라우드 허브: 멀티클라우드 시대의 디지털 비즈니스 핵심 전략
 
Amazon SageMaker JumpStart
Amazon SageMaker JumpStartAmazon SageMaker JumpStart
Amazon SageMaker JumpStart
 
Amazon EMR과 SageMaker를 이용하여 데이터를 준비하고 머신러닝 모델 개발 하기
Amazon EMR과 SageMaker를 이용하여 데이터를 준비하고 머신러닝 모델 개발 하기Amazon EMR과 SageMaker를 이용하여 데이터를 준비하고 머신러닝 모델 개발 하기
Amazon EMR과 SageMaker를 이용하여 데이터를 준비하고 머신러닝 모델 개발 하기
 
AWS 활용한 Data Lake 구성하기
AWS 활용한 Data Lake 구성하기AWS 활용한 Data Lake 구성하기
AWS 활용한 Data Lake 구성하기
 
AWS Summit Singapore - Core FSI workloads on the cloud
AWS Summit Singapore - Core FSI workloads on the cloudAWS Summit Singapore - Core FSI workloads on the cloud
AWS Summit Singapore - Core FSI workloads on the cloud
 
Introducing Amazon SageMaker
Introducing Amazon SageMakerIntroducing Amazon SageMaker
Introducing Amazon SageMaker
 
Scaling Ride-Hailing with Machine Learning on MLflow
Scaling Ride-Hailing with Machine Learning on MLflowScaling Ride-Hailing with Machine Learning on MLflow
Scaling Ride-Hailing with Machine Learning on MLflow
 
Az 104 session 6 azure networking part2
Az 104 session 6 azure networking part2Az 104 session 6 azure networking part2
Az 104 session 6 azure networking part2
 
Databricks on AWS.pptx
Databricks on AWS.pptxDatabricks on AWS.pptx
Databricks on AWS.pptx
 
Managing the Machine Learning Lifecycle with MLOps
Managing the Machine Learning Lifecycle with MLOpsManaging the Machine Learning Lifecycle with MLOps
Managing the Machine Learning Lifecycle with MLOps
 
20191030 AWS Black Belt Online Seminar AWS IoT Analytics Deep Dive
20191030 AWS Black Belt Online Seminar AWS IoT Analytics Deep Dive 20191030 AWS Black Belt Online Seminar AWS IoT Analytics Deep Dive
20191030 AWS Black Belt Online Seminar AWS IoT Analytics Deep Dive
 
AWS Quicksight에서의 비즈니스 인텔리전스 - 김기완 :: 2015 리인벤트 리캡 게이밍
AWS Quicksight에서의 비즈니스 인텔리전스 - 김기완 :: 2015 리인벤트 리캡 게이밍AWS Quicksight에서의 비즈니스 인텔리전스 - 김기완 :: 2015 리인벤트 리캡 게이밍
AWS Quicksight에서의 비즈니스 인텔리전스 - 김기완 :: 2015 리인벤트 리캡 게이밍
 
AWS networking fundamentals
AWS networking fundamentalsAWS networking fundamentals
AWS networking fundamentals
 
누가 내 엔터프라이즈 고객을 클라우드로 옮겼을까?-양승호, Head of Cloud Modernization,AWS::AWS 마이그레이션 ...
누가 내 엔터프라이즈 고객을 클라우드로 옮겼을까?-양승호, Head of Cloud Modernization,AWS::AWS 마이그레이션 ...누가 내 엔터프라이즈 고객을 클라우드로 옮겼을까?-양승호, Head of Cloud Modernization,AWS::AWS 마이그레이션 ...
누가 내 엔터프라이즈 고객을 클라우드로 옮겼을까?-양승호, Head of Cloud Modernization,AWS::AWS 마이그레이션 ...
 
Aws overview (Amazon Web Services)
Aws overview (Amazon Web Services)Aws overview (Amazon Web Services)
Aws overview (Amazon Web Services)
 
Bringing API Management to AWS Powered Backends
Bringing API Management to AWS Powered BackendsBringing API Management to AWS Powered Backends
Bringing API Management to AWS Powered Backends
 
효율적인 빅데이터 분석 및 처리를 위한 Glue, EMR 활용 - 김태현 솔루션즈 아키텍트, AWS :: AWS Summit Seoul 2019
효율적인 빅데이터 분석 및 처리를 위한 Glue, EMR 활용 - 김태현 솔루션즈 아키텍트, AWS :: AWS Summit Seoul 2019효율적인 빅데이터 분석 및 처리를 위한 Glue, EMR 활용 - 김태현 솔루션즈 아키텍트, AWS :: AWS Summit Seoul 2019
효율적인 빅데이터 분석 및 처리를 위한 Glue, EMR 활용 - 김태현 솔루션즈 아키텍트, AWS :: AWS Summit Seoul 2019
 
롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...
롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...
롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...
 
Google Anthos - Azure Stack - AWS Outposts :Comparison
Google Anthos - Azure Stack - AWS Outposts :ComparisonGoogle Anthos - Azure Stack - AWS Outposts :Comparison
Google Anthos - Azure Stack - AWS Outposts :Comparison
 
Azure Networking (1).pptx
Azure Networking (1).pptxAzure Networking (1).pptx
Azure Networking (1).pptx
 

Similar to Using the Kentico CMS API

SharePoint 2007 and SharePoint 2010 for Web Content Management (WCM)
SharePoint 2007 and SharePoint 2010 for Web Content Management (WCM)SharePoint 2007 and SharePoint 2010 for Web Content Management (WCM)
SharePoint 2007 and SharePoint 2010 for Web Content Management (WCM)
Richard Harbridge
 
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01
Raza Baloch
 
I p-o in different data processing systems
I p-o in different data processing systemsI p-o in different data processing systems
I p-o in different data processing systems
Kinshook Chaturvedi
 
Configuration Management
Configuration ManagementConfiguration Management
Configuration Management
elliando dias
 
Content Typing, Flows, Models by Rahel Anne Bailie
Content Typing, Flows, Models by Rahel Anne BailieContent Typing, Flows, Models by Rahel Anne Bailie
Content Typing, Flows, Models by Rahel Anne Bailie
Content Strategy Workshops
 

Similar to Using the Kentico CMS API (20)

Patterns For Parallel Computing
Patterns For Parallel ComputingPatterns For Parallel Computing
Patterns For Parallel Computing
 
Ikenstudiolive
IkenstudioliveIkenstudiolive
Ikenstudiolive
 
How To Implement a CMS
How To Implement a CMSHow To Implement a CMS
How To Implement a CMS
 
ASMUG February 2015 Knowledge Event
ASMUG February 2015 Knowledge EventASMUG February 2015 Knowledge Event
ASMUG February 2015 Knowledge Event
 
SharePoint 2007 and SharePoint 2010 for Web Content Management (WCM)
SharePoint 2007 and SharePoint 2010 for Web Content Management (WCM)SharePoint 2007 and SharePoint 2010 for Web Content Management (WCM)
SharePoint 2007 and SharePoint 2010 for Web Content Management (WCM)
 
FME World Tour 2015 - FME & Data Migration Simon McCabe
FME World Tour 2015 -  FME & Data Migration Simon McCabeFME World Tour 2015 -  FME & Data Migration Simon McCabe
FME World Tour 2015 - FME & Data Migration Simon McCabe
 
DBMS an Example
DBMS an ExampleDBMS an Example
DBMS an Example
 
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01
 
Choosing a CMS: One Management System to Rule Them All?
Choosing a CMS: One Management System to Rule Them All?Choosing a CMS: One Management System to Rule Them All?
Choosing a CMS: One Management System to Rule Them All?
 
CMS by Thai Son
CMS by Thai SonCMS by Thai Son
CMS by Thai Son
 
Sad52 requirement
Sad52 requirementSad52 requirement
Sad52 requirement
 
CUST-3 Document Management with Share
CUST-3 Document Management with ShareCUST-3 Document Management with Share
CUST-3 Document Management with Share
 
Ch13
Ch13Ch13
Ch13
 
Content mgmtsys
Content mgmtsysContent mgmtsys
Content mgmtsys
 
Moss Governance Guidelines
Moss Governance GuidelinesMoss Governance Guidelines
Moss Governance Guidelines
 
WPF Windows Presentation Foundation A detailed overview Version1.2
WPF Windows Presentation Foundation A detailed overview Version1.2WPF Windows Presentation Foundation A detailed overview Version1.2
WPF Windows Presentation Foundation A detailed overview Version1.2
 
3-Tier Architecture Step By Step Exercises
3-Tier Architecture Step By Step Exercises3-Tier Architecture Step By Step Exercises
3-Tier Architecture Step By Step Exercises
 
I p-o in different data processing systems
I p-o in different data processing systemsI p-o in different data processing systems
I p-o in different data processing systems
 
Configuration Management
Configuration ManagementConfiguration Management
Configuration Management
 
Content Typing, Flows, Models by Rahel Anne Bailie
Content Typing, Flows, Models by Rahel Anne BailieContent Typing, Flows, Models by Rahel Anne Bailie
Content Typing, Flows, Models by Rahel Anne Bailie
 

More from Thomas Robbins

One Size does Not Fit All: Selecting the Right Mobile StrategyKentico mobil...
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico   mobil...One Size does Not Fit All: Selecting the Right Mobile StrategyKentico   mobil...
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico mobil...
Thomas Robbins
 

More from Thomas Robbins (20)

PlayFab Advanced Cloud Script
PlayFab Advanced Cloud ScriptPlayFab Advanced Cloud Script
PlayFab Advanced Cloud Script
 
What’s in the box? Creating chance mechanics and rewards
What’s in the box? Creating chance mechanics and rewardsWhat’s in the box? Creating chance mechanics and rewards
What’s in the box? Creating chance mechanics and rewards
 
Getting started with Cloud Script
Getting started with Cloud ScriptGetting started with Cloud Script
Getting started with Cloud Script
 
Say hello to the new PlayFab!
Say hello to the new PlayFab!Say hello to the new PlayFab!
Say hello to the new PlayFab!
 
Data-Driven Government: Explore the Four Pillars of Value
Data-Driven Government: Explore the Four Pillars of ValueData-Driven Government: Explore the Four Pillars of Value
Data-Driven Government: Explore the Four Pillars of Value
 
Financial Transparency Trailblazers
Financial Transparency TrailblazersFinancial Transparency Trailblazers
Financial Transparency Trailblazers
 
Telling Stories with Open Data
Telling Stories with Open DataTelling Stories with Open Data
Telling Stories with Open Data
 
Socrata Financial Transparency Suite
Socrata Financial Transparency Suite Socrata Financial Transparency Suite
Socrata Financial Transparency Suite
 
Socrata Service Connect
Socrata Service ConnectSocrata Service Connect
Socrata Service Connect
 
Leveraging Data to Engage Citizens and Drive Innovation
Leveraging Data to Engage Citizens and Drive InnovationLeveraging Data to Engage Citizens and Drive Innovation
Leveraging Data to Engage Citizens and Drive Innovation
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
 
Here Comes Kentico 8
Here Comes Kentico 8Here Comes Kentico 8
Here Comes Kentico 8
 
Say hello to Kentico 8! Your integrated marketing solution has arrived
Say hello to Kentico 8! Your integrated marketing solution has arrivedSay hello to Kentico 8! Your integrated marketing solution has arrived
Say hello to Kentico 8! Your integrated marketing solution has arrived
 
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico mobil...
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico   mobil...One Size does Not Fit All: Selecting the Right Mobile StrategyKentico   mobil...
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico mobil...
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
 
Digital marketing best practices
Digital marketing best practices Digital marketing best practices
Digital marketing best practices
 
Do you speak digital marketing with Kentico CMS?
Do you speak digital marketing with Kentico CMS?Do you speak digital marketing with Kentico CMS?
Do you speak digital marketing with Kentico CMS?
 
Common questions for Windows Azure and Kentico CMS
Common questions for Windows Azure and Kentico CMSCommon questions for Windows Azure and Kentico CMS
Common questions for Windows Azure and Kentico CMS
 
Advanced development with Windows Azure
Advanced development with Windows AzureAdvanced development with Windows Azure
Advanced development with Windows Azure
 
Best Practices for Kentico CMS and Windows Azure
Best Practices for Kentico CMS and Windows AzureBest Practices for Kentico CMS and Windows Azure
Best Practices for Kentico CMS and Windows Azure
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Using the Kentico CMS API

  • 1. Using the Kentico CMS API Thom Robbins (thomasr@kentico.com Bryan Soltis (bryan@bitwizards.com)
  • 2. Agenda • Overview (Architecture/Objects) (Thom) • CMS Context (Bryan) • Document Management (Thom) • Global Events (Thom) • Modules (Bryan)
  • 3. Looking at Kentico CMS Logical three tier architecture…
  • 4. Architecture breakdown Data layer (+metadata) Business layer Controls libraries UI components Web project pages Live site pages + admin UI pages Web parts + User controls CMSControls Helpers SettingsProvider Enumerations Infos & Providers Data engine GeneralConnection Abstract info Metadata infos (Class, Query, SettingsKey) Interfaces Third party code Module web parts + Module user controls Module controls Module Infos & Providers Module definitions Presentationlayer Best Practice Tip • Kentico CMS web site project provides examples of all sorts of code!
  • 5. 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); // Prepare the TreeProvider (it must be initialized with user information when editing document structure) UserInfo ui = 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 - Creating new user Example – Delete Document
  • 6. API Everywhere! • Class View is your Friend CMS.SettingsProvider .SettingsHelper .SQLHelperClass .TranslationHelp er CMS.GlobalHelper .DataHelper .ContextHelper .AJAXHelper Library Specific CMS.Controls.CM SControlsHelper CMS.WorkflowEn gine.DocumentHe lper CMS.Blogs.BlogHe lper Some Examples… Best practice Tip: Class view is customizable to allow personalized organization and viewing
  • 7. Helpers and general libraries SettingsProvider (metadata helpers) SettingsHelper (web.config) SettingsKeyHelper (web site settings) SqlHelperClass (low level DB connection, used only from SettingsProvider) DataHelper (basic data manipulation) TranslationHelper (conversion of IDs based on code names or GUIDs) GlobalHelper (general helpers) /Context (HTTP context related data) /Data (advanced data manipulation and validation) /Globalization (resource strings and cultures) /Markup (macros, HTML, XML, text, script) /Media (images and media manipulation and information) Library specific (module helpers) ControlsHelper CMSControlsHelper DocumentHelper WebFarmSyncHelperClass Etc. App_Code (helper functions) Functions.cs InstallerFunctions.cs BlogFunctions.cs EcommerceFunctions.cs Etc. 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
  • 8. CMS Context • CMS.CMSHelper.CMSContext class provides static methods to access common information Method CurrentAliasPath CurrentDocument CurrentPageInfo CurrentSite CurrentSiteName CurrentUser ViewMode ResolveCurrentPath Need a code snippet?
  • 9. 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 CMS_Tree CMS_Document Coupled table CMS_Document Coupled table CMS_Document Coupled table Best Practice Tip: Every document is stored in up to three (3) tables. Use the API to access documents
  • 10. 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. CMS_VersionHistory CMS_VersionAttachment CMS_AttachmentHistory Version of attachments CMS_VersionAttachment CMS_AttachmentHistory Version of attachments
  • 11. Document Management Techniques CMS.TreeEngine.TreeNode • Not aware of versioning/workflow/attachments • Only works with published records CMS.WorkflowEngine.DocumentHelper • Versioning/workflow/attachment aware • Use for all document deletes 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
  • 12. 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
  • 13. Global Event Classes • The events are applied to all data items that are stored to the database. It includes documents, user information or any other settings • Receives DataClass CustomDataHandler.cs • Event applied to all exceptions that occur • Receives System.exception CustomExceptionHandler.cs • Allows the integration of external databases and modify the authentication and authorization processCustomSecurityHandler.cs • Execute custom actions when a document is created, updated or deletedCustomTreeNodeHandler.cs • Event applied to workflow documents (same as CustomTreeNodeHandler) • Same as CustomtreeNodeHandler CustomWorkflowHandler.cs Best Practice Tip: For Document events always use either the CustomTreeNodeHandler (no workflow) or CustomWorkFlowHandler (workflow) not the CustomDataHandler
  • 14. Modules • Extend the CMS system to include your custom code
  • 15. 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

Editor's Notes

  1. Standard 3-tier architecture Data driven object model (bussiness layer objects content based on metadata) UI consists of server controls, user controls and pages Modules are logically separated
  2. We have helpers for almost everything If you plan to write any general code that can be used later by someone else: Locate the helper If the helper contains the method, use it If the helper contains similar method, enhance it by overriding it and provide original method so that the behavior of existing calls stays the same If the helper doesn’t contain the method, implement it in the helper