Storing custom data for all document types

If you need to add custom data fields to all documents, regardless of document type, use the NodeCustomData column of the CMS_Tree database table, or the DocumentCustomData column of the CMS_Document table.

You can access the columns in the API using properties of objects of the TreeNode class:

  • TreeNode.NodeCustomData
  • TreeNode.DocumentCustomData

The properties provide two ways to store values:

Storing a single ntext value

treeNode.NodeCustomData.Value = "Single block of text";

Storing a collection of custom values in XML format

treeNode.NodeCustomData["CustomProperty1"] = "Value 1";
treeNode.NodeCustomData["CustomProperty2"] = "Value 2";