CSApprovedDocumentInformation Class Content Studio 5.7 SDK
Content Studio Web Content Management System

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

CSApprovedDocumentInformation is used when there is a need for an object oriented way of reading document information available to a caller that only has BROWSE permission on the document.
Inheritance Hierarchy

SystemObject
  ContentStudio.DocumentCSApprovedDocumentInformation

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

public class CSApprovedDocumentInformation

The CSApprovedDocumentInformation type exposes the following members.

Constructors

  NameDescription
Protected methodCSApprovedDocumentInformation(ConnectionId, SessionId, DocumentId)
Creates a new instance of the CSApprovedDocumentInformation class using a specific connectionId, sessionId and documentId
Public methodCSApprovedDocumentInformation(ConnectionId, SessionId, DocumentId, Boolean)
Creates a new instance of the CSApprovedDocumentInformation class and loads document information using a specific connectionId, sessionId and documentId with the possibility to specify whether or not to load content data.
Top
Properties

  NameDescription
Public propertyArchiveDate
Gets a value that indicates if and when the document will be archived.
Public propertyCategoryId
Gets a value that specifies the identifier of the category of the loaded document.
Public propertyConnectionID
Gets the unique identifier of the current site.
Public propertyContentType
Gets the content type (Mime type) of a document.
Public propertyCreatedDate
Gets a value that specifies when the loaded document was created.
Public propertyDocumentID
Gets an identifier of the loaded document.
Public propertyDocumentName
Gets the name of the loaded document.
Public propertyDocumentType
Gets a value that indicates the type of document loaded
Public propertyEPTData
Gets the content of an EPT document as an EPTXmlTextParser.
Public propertyFileExtension
Gets the file extension of the file representation of the loaded document.
Public propertyFileName
Gets the complete file name of the underlying file representation of the loaded document.
Public propertyImageAvailability
Gets a value that indicates what types of image processed image versions of the document that is available.
Public propertyIntroduction
Gets a value that contains the introduction of the loaded document's content data.
Public propertyMenuData
Gets a value that specifies a user defined data for menu items. Only applicable if the document acts as a menu node.
Public propertyMenuTarget
Gets a value that specifies the user defined target for menu items. Only applicable if the document acts as a menu node.
Public propertyMenuUrl
Gets a value that specifies a user defined url data for menu items. Only applicable if the document acts as a menu node.
Public propertyModifiedDate
Gets a value that indicates when the document was modified.
Public propertyParentDocumentId
Gets a value that indicates the document that acts as the parent document of the loaded document.
Public propertyPublishDate
Gets a value that specifies when the document was, or will be, published.
Public propertyPublishStatus
Gets a value that indicates the current publish status of the loaded document.
Public propertyRevision
Gets a value that indicates the revision number of the currently approved version of the document.
Public propertyRevisionDate
Gets a value that specifies the date when the currently approved version of the document was approved.
Public propertySessionID
Gets the Session identifier of the calling user.
Public propertyVirtualPath
Gets a value that specifies the virtual path of the loaded document.
Top
Methods

  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Protected methodOpenDocument
Loads the document data into this instance
Public methodToString (Inherited from Object.)
Top
Remarks

When building web sites, sometimes it can be necessary to obtain meta data information about a document such as its name, content type and file extension. In addition to this some content type such as Introduction might be useful. This data is easy to obtain using the CSDocumentInformation object but most of the more powerful objects and calls are designed with the possibility to edit the document in mind thus requiring READ permission for the caller. CSApprovedDocumentInformation is designed to be able to return as much information as possible for a document without revealing any sensitive information to the public Internet and has been optimized for being fast and resource effective. All of the properties are loaded using one database call for the data and one additional call when determining the document type.
When using this class you can choose between loading and not loading content related data. For performance reasons you should not request the content related data unless you really need those properties.
The following properties are content related.
PropertyValue when not initialized
Introductionnull (Nothing in Visual Basic)
MenuUrlnull (Nothing in Visual Basic)
MenuDatanull (Nothing in Visual Basic)
MenuTargetnull (Nothing in Visual Basic)
RevisionDatenull (Nothing in Visual Basic)
Revisionzero


Why can't I read the actual content of the document?
The approved content, is stored in a binary blob field the database and cannot be used directly. In addition to this field, the source code of the document is stored as well, but that field is not very useful either and might contain sensitive information. The only exception is EPT-documents whose content contains the Xml in its native format. For that reason the only content that can be read with CSApprovedDocumentInformation is the content of EPT documents. In order to get the content of a regular Html document you can get it directly from the file system.

Security warning!
It is up to you as a programmer to wisely judge what information is acceptable to display on a public web page. For example: An EPT document might contain fields with classified data that are filtered out by using carefully crafted presentation templates. But, with CSApprovedDocumentInformation, you can easily bypass any business rules specified in presentation templates thus causing unwanted information leaks.
Examples

The sample shows how to load the current document and write out some of its properties. The code will only work within Content Studio.

Response.Write("<h4>A number of properties of this document</h4><br />\r\n");
try
{
   CSApprovedDocumentInformation adi = new CSApprovedDocumentInformation(CS_ConnectionId, 
                                                                         CS_UserSessionId, 
                                                                         CS_InsertedDocumentId, 
                                                                         false);
   Response.Write("<table>\r\n");
   Response.Write(" <tr>\r\n");
   Response.Write("  <td>Document name</td>\r\n");
   Response.Write("  <td>" + Server.HtmlEncode(adi.DocumentName) + "</td>\r\n");
   Response.Write(" </tr>\r\n");
   Response.Write(" <tr>\r\n");
   Response.Write("  <td>File extension</td>\r\n");
   Response.Write("  <td>" + adi.FileExtension + "</td>\r\n");
   Response.Write(" </tr>\r\n");
   Response.Write("</table>\r\n");
 }
 catch(CSPermissionDeniedException)
 {
    Response.Write("<b>Sorry no permission to read!</b><br />\r\n");
 }
 catch (Exception ex)
 {
    Response.Write("<b>Error: </b>" + ex.GetType().ToString() + "<br />" + ex.Message + "<br />\r\n");
 }
See Also

Reference