I have a custom document type called health article.
When I use the API to create a new document, it does not honor the values I have set for the document name and node alias path in the CMS Site Manager.
How can I retrieve which columns to use for the document name and the node alias using the API?
I thought that the code below would work (using those properties within (DataClassInfoProvider.GetDataClass())), but it does not.
var tree = new TreeProvider(userInfo);
using (var parentNode = tree.SelectSingleNode(CMSContext.CurrentSiteName, parentNodePath, "##ALL##", true, "CMS.MenuItem", false))
{
if (parentNode == null)
{
return;
}
var dataClass = DataClassInfoProvider.GetDataClass(CustomFunctions.CustomArticle);
if (dataClass == null)
{
throw new Exception("Given document type does not exist.");
}
// Create a new instance of the Tree node
var newNode = TreeNode.New(CustomFunctions.CustomArticle, tree);
var nodeAliasColumn = dataClass.ClassNodeAliasSource;
var nodeAlias = newNode.GetValue(nodeAliasColumn).ToString();
newNode.NodeAlias = nodeAlias;
newNode.DocumentName = newNode.GetValue(dataClass.ClassNodeNameSource).ToString();
try
{
// Insert the document into the content tree
newNode.Insert(parentNode);
Thanks,
Joe Hoppe