Site.getTreeItems (Method)

Returns zero or more structures, each containing information about each child object based upon the type of object and its parent. Structure members include the node's text, if the node is a leaf node, if the node is selectable, and so on.

Returns:

Site_GetTreeItems_Result (query)

Each row of the returned query results has the following fields:

Field Name Type Description
ID PlainText_NonNull The ID of the data returned.
Leaf Boolean Boolean flag which when true indicates that the item is a leaf node.
LeafNodeNodeType TreeNodeType_EmptyString Returns information passed in for LeafNodeNodeType.
OtherInfo PlainText Other data about the item. This value can be NULL.
Selectable Boolean Boolean flag which when true indicates that this item is selectable.
Selected Boolean Boolean flag which when true indicates that the node is selected.
Text PlainText_NonNull Text of the node that will be displayed.
Type TreeNodeType_EmptyString If this node type is passed to GetTreeItems(), it returns this item's child nodes. For example, if 'ElementCategory' is passed as the NodeType to GetTreeItems() the type returned for each item is 'Element'. If the node is a leaf node, this field is NULL.

Arguments:

Name Type Required Description
nodeType TreeNodeType Required String identifying a tree node's type; for example, contributors, directories, image files, render handlers, and so on. For example, if this node type is 'SubsiteName, you would set this to '/demo'. This tells CommonSpot to returns all of the child's subsites. If this node type is 'Element', pass 'categoryID'. If this node type is 'RenderHandler' pass 'ElementID'. A 'ParentID' is not needed for: 'PageCategory', 'DocumentType', and 'ElementCategory'.
parentID String Optional. Defaults to an empty string. A string describing the parent node based on the specified TreeType. This value need not be an integer. If this is an empty string, CommonSpot returns all top level nodes of the specified type; for example, if the node type is 'PageCategory', CommonSpot ignores the ParentID as there is no hierarchy. If the node type is 'UsersGroupsCurrentUser', this value should be an empty string. CommonSpot returns branches for Current User, Users, and Groups where the current user will be a leaf node with a value of -1.
excludeIDList NonNegativeIntegerList_EmptyString Optional. Defaults to an empty string. A comma-delimited list of IDs to exclude.
leafNodeNodeType TreeNodeType_EmptyString Optional. Defaults to an empty string. If this argument exists and is equal to the NodeType value, all returned items are leaf nodes. An empty string indicates that CommonSpot does not include leaf node types. As this function is called recursively, it can stop recursion at a specified level. For example you may just want to return a list of elements but the elements can be expanded to show render handlers. In this case, pass 'Elements'.
requiredPermission SubsiteGeneralPermission_EmptyString Optional. Defaults to an empty string. The name of the permission for which CommonSpot will check. Only use this argument if 'NodeType' is 'Subsites'. If the current user has this permission, the item is selectable. If the item and none of its descendants are selectable, CommonSpot omits this item.
preSelectedIDList NonNegativeIntegerList_EmptyString Optional. Defaults to an empty string. A comma-delimited list of items that will be preselected.

Context:

License Requirements None
Permission Requirements ContributorOrServerCode
Deny Context None
Require Context None
Author Lock  

Error Codes:

Code Error Message
46001 A parent ID is not required for node type '$1'.
46002 A parent ID is required.
46003 The format for the parent ID is not valid. It should be alpha:orgID.
46006 Only use the RequiredPermission argument when the NodeType is Subsites.
46007 The specified directory does not match a directory in the current site ($1).
46008 The specified directory does not exist.

Notes:

None