Kentico CMS 6.0 Developer's Guide

Custom document data

Custom document data

Previous topic Next topic Mail us feedback on this topic!  

Custom document data

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

In some cases, you may need to add custom data to all documents. In this case, you can use the NodeCustomData or DocumentCustomData (culture specific) fields in the CMS_Tree and CMS_Document database tables, respectively.

 

These fields are accessible through the following properties of the document (TreeNode):

 

TreeNode.NodeCustomData

TreeNode.DocumentCustomData

 

You can use these values in two ways:

 

1. You can use them as a single ntext block of text:

 

[C#]

 

TreeNode.NodeCustomData.Value = "my value";

 

 

2. You can use them as a collection of custom values that are stored as an XML document:

 

[C#]

 

TreeNode.NodeCustomData["myproperty1"] = "my value 1";

TreeNode.NodeCustomData["myproperty2"] = "my value 2";

 

If you would like to learn how to create a new document type or modify fields of an existing one, please refer to the Document types and transformations chapter in the Development section of this guide.