CategoryReaderGetCategoriesInUnit Method (ConnectionId, SessionId, UnitId, String) Content Studio 5.7 SDK
Content Studio Web Content Management System

[This is preliminary documentation and is subject to change.]

Returns a filtered list of categories including subcategories in a unit.

Namespace: ContentStudio.Document
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
Syntax

public string GetCategoriesInUnit(
	ConnectionId connectionId,
	SessionId sessionId,
	UnitId unitId,
	string moduleName
)

Parameters

connectionId
Type: ContentStudioConnectionId
A value that identifies the web site
sessionId
Type: ContentStudio.SecuritySessionId
A value that identifies the user's session. This value usually originates from a call to OpenSession(ConnectionId).
unitId
Type: ContentStudio.DocumentUnitId
An identifier of a unit to list from. This must be an existing unit.
moduleName
Type: SystemString
A name of a module that specifies the type of categories to list. This parameter can be null (Nothing in Visual Basic) or an Empty to return any type of category.
To return a specfic type of category you can use the moduleName argument to supply a filter. The table below lists the supported value for moduleName which are not case sensitive.
ModuleNameDescription.
ActiveScriptingThe category contains AS-components.
DokumentThe category contains regular documents, with or without meta data.
EditTemplateThe category contains Editing templates.
FilThe category contains uploaded files
FormatmallThe category contains templates (for fragments of a page).
HelsidesmallThe category contains document templates.
PresentationTemplateThe category contains presentation templates.
XMLDocumentThe category contains EPT documents.

Return Value

Type: String
XML containing a list of categories.
<root>
    <status>Integer value</status>
    <statustext>String value</statustext>
    <categories>
        <cs_category>
            <categoryid>Integer value</categoryid>
            <categoryname>String value</categoryname>
            <modulename>String value</modulename>
            <unitname>String value</unitname>
            <unitid>Integer value</unitid>
            <edittemplateid>Integer value</edittemplateid>
        </cs_category>
        <!-- more cs_category elements can follow -->
    </categories>
</root>

This xml has the following members and meaning

ElementDescription
root/statusInteger: The outcome of the call. Always 0, success
root/statustextString: The text representation of outcome of the call. Always OK
root/categoriesThe root element of the category list
root/categories/cs_categoryThe root element of a found category. This element occurs once for each found category.
root/categories/cs_category/categoryidInteger: The category identifier
root/categories/cs_category/categoryname The relative path name to the category (e.g. MyUnit/TheCategory).

This relative path is the path in the underlying file system which means that some of the special system folders are different from the path shown in Content Studio.

These are i version 5.1: Special category mappings
IdFolderMaps to
99System/AssembliesBin
98System/App_CodeApp_Code
97System/App_Code/CSCodeApp_Code/CSCode
96System/App_Code/VBCodeApp_Code/VBCode
95System/App_ThemesApp_Themes
94System/App_GlobalResourcesApp_GlobalResources
root/categories/cs_category/modulenameString: A value that indicates the type of category. This value cannot fully be used to determine the type of a category. Use the GetDocumentType(ConnectionId, SessionId, CategoryId) method to determine the type of document a category can contain.
root/categories/cs_category/unitnameThe name of the unit specified in unitId. This value is the same for each category
root/categories/cs_category/unitidThe identifier of the unit specified in unitId. This value is the same for each category.
root/categories/cs_category/edittemplateidThe identifier of the edit template of the category. This value is zero if not an ept document category.
Content Studio permissions

Only categories where the user has READ permission are returned.
Remarks

This method is mostly included in the CS API for backward compatibility reasons. The method reads all categories in the unit regardless of their level and callers must use the categoryname xml element to determine the level of a specific category.
Note Note
This API should be avoided; new applications should use the GetCategoryList instead which can read categories per level in a structured way.
Examples

The following code sample (error handling omitted) returns all categories from in a certain unit that can contain EPT xml documents.
private string GetCatsUnits()
{
   // The commented code below is for application outside
   // a Content Studio web site only. This code block
   // opens a new session but since sessions identifiers and connection identifiers
   // are already available on the web site there is no need for this.
   /*
     const int CS_ConnectionId = 1236;
     SessionManager sman = new SessionManager();
     int CS_UserSessionId = sman.OpenSession(CS_ConnectionId);
   */
   CategoryReader c = new CategoryReader();
   return c.GetCategoriesInUnit(CS_ConnectionId, CS_UserSessionId, 2, "XMLDocument");
}
See Also

Reference