DirectiveControlGetDirective Method (ConnectionId, SessionId, Int32, CSFileObjectTypes, DirectiveControlDirectiveClass, Int32) Content Studio 5.7 SDK
Content Studio Web Content Management System

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

Returns the directive attribute in use with a certain ASP.NET directive.

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

public string GetDirective(
	ConnectionId connectionId,
	SessionId sessionId,
	int objectId,
	CSFileObjectTypes objectType,
	DirectiveControlDirectiveClass directiveType,
	int versionNumber


Type: ContentStudioConnectionId
A value that identifies the web site
Type: ContentStudio.SecuritySessionId
A value that identifies the user's session. This value usually originates from a call to OpenSession(ConnectionId).
Type: SystemInt32
The object to get attributes for.
Type: ContentStudio.DocumentCSFileObjectTypes
The type of Content Studio object referenced by the ObjectID parameter
Type: ContentStudio.DocumentDirectiveControlDirectiveClass
The type of directive to use e.g. DirectiveClass.Page
Type: SystemInt32
Indicates the version number of the document. Ignored unless objectType is Document. Use the following values to determine what document version to read directive for:
less than -2Fails with an ArgumentOutOfRangeException.
-2Read the current draft or if not found the current approved version.
-1Read the current draft.
0Read the approved document.
greater than 0Read the version with this specific version number.

Return Value

Type: String
Xml, a simple one tag document with the attributes in use and their values. The content of the xml is dependent on what type of directive to get and what types of directives that does not have default values.

   <Page Language="VB" Strict="true" />
   <OutputCache Duration="100" VaryByParam="di" Location="Server" />

The element names returned are the directive name and the attributes defines the attributes of the directive. The following directives can be returned.

DirectiveDescriptionRead more
AssemblyLinks an assembly to the current page or user control declaratively
ControlDefines control-specific attributes used by the ASP.NET page parser and compiler and can be included only in .ascx files (user controls).
ImportImports a namespace into a page or user control explicitly.
MasterIdentifies a page as a master page and defines attributes used by the ASP.NET page parser and compiler and can be included only in .master files
OutputCacheControls the output caching policies of a page or user control declaratively
PageDefines page-specific attributes used by the ASP.NET page parser and compiler and can be included only in .aspx files
ReferenceLinks a page, user control, or COM control to the current page or user control declaratively
RegisterAssociates aliases with namespaces and classes, which allow user controls and custom server controls to be rendered when included in a requested page or user control

CSExceptionA business rule was violated in the underlying Content Studio database
  • 1001 - Session is invalid.
  • 1002 - Permission denied.
  • 1004 - The container is missing.
  • 1009 - Invalid parameter value
  • 1100 - The document is missing
  • -1 - The directive is not found
CSInvalidSessionExceptionThe session is invalid (version 5.4 and later)
CSPermissionDeniedExceptionPermission denied (version 5.4 and later)
CSInvalidParameterExceptionInvalid parameter value (version 5.4 and later)
CSDocumentNotFoundExceptionThe document is missing (version 5.4 and later)
ArgumentOutOfRangeExceptionThe versionNumber is invalid
SqlExceptionAn error occurred when executing the command against the Content Studio database
Content Studio permissions

READ / READ CONTAINER permission on the document / container is required.

This method was added in CS 5.4 to support the extended versioning.

This method will return same result as GetDirective unless the objectType is Document.

If the requested version number cannot be found in the revision store the method will return the draft directives or, when not found, directives for the approved version.

See Also


Other Resources