private Exception GetNotAllowedContentTypeExceptionOnMove(Node node, GenericContent target)
{
var ancestor = target;
while (ancestor.NodeType.Name == "Folder" || ancestor.NodeType.Name == "Page")
{
var p = ancestor.Parent as GenericContent;
if (p == null)
break;
ancestor = p;
}
var contentTypeName = node.NodeType.Name;
return new InvalidOperationException(String.Format("Cannot move the content '{0}' to '{1}' because target's ancestor does not allow the type '{2}'. Ancestor: {3} ({4}). Allowed types: {5}"
, node.Path, target.Path, contentTypeName, ancestor.Path, ancestor.NodeType.Name, String.Join(", ", target.GetAllowedChildTypeNames())));
}
public void AllowChildType(string contentTypeName, bool setOnAncestorIfInherits = false, bool throwOnError = true, bool save = false)