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

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

This class provides a updatable implementation of the CSDocumentInformation class and provides an object oriented approach to editing, saving and approving Content Studio documents.
Inheritance Hierarchy

SystemObject
  ContentStudio.DocumentCSDocument
    ContentStudio.DocumentCSDocumentInformation
      ContentStudio.DocumentCSSyncronizedDocument

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

public class CSSyncronizedDocument : CSDocumentInformation, 
	IDisposable

The CSSyncronizedDocument type exposes the following members.

Constructors

  NameDescription
Public methodCSSyncronizedDocument(ConnectionId, SessionId, CategoryId, String)
Creates a new instance of the CSSyncronizedDocument object that represents an empty document to be created. Use this constructor when you intend to create a new document.
Public methodCSSyncronizedDocument(ConnectionId, SessionId, DocumentId, CSDocumentInformationContentToLoad)
Creates a new instance of the CSSyncronizedDocument class and loads the content of an existing Content Studio document. Use this constructor when you intend to work with an existing document.
Public methodCSSyncronizedDocument(ConnectionId, SessionId, CategoryId, String, String)
Creates a new instance of the CSSyncronizedDocument object that represents an empty document to be created. Use this constructor when you intend to create a new document.
Top
Properties

  NameDescription
Public propertyAllowedFiletypes
Gets the file extensions allowed for this document.
(Overrides CSDocumentInformationAllowedFiletypes.)
Public propertyApprovedDate
Gets a value that indicates when the most recent published version document published.
(Inherited from CSDocumentInformation.)
Public propertyApprover
Gets the name of the person that published the most recent version of the document.
(Inherited from CSDocumentInformation.)
Public propertyArchiveDate
Gets a value that specifies the archive date of the document.
(Inherited from CSDocumentInformation.)
Public propertyBodyProperties
Gets a value that specifies the content of the document's BODY tag.
(Inherited from CSDocumentInformation.)
Protected propertyCanSetInitialPropertyValue
Sets or gets a value that indicates whether initial document properties can be written or not.
(Inherited from CSDocumentInformation.)
Protected propertyCanSetPropertyValue
Sets or gets a value that indicates whether updatable properties can be written or not.
(Inherited from CSDocumentInformation.)
Public propertyCategoryID
Gets that specifies the category of a document. Default value is zero.
(Inherited from CSDocumentInformation.)
Public propertyCheckOutBy
Gets a value that indicates the name of the person that has the document checked out.
(Inherited from CSDocumentInformation.)
Public propertyCheckOutById
Gets a value that indicates the internal id of the caller that has checked out the document.
(Inherited from CSDocumentInformation.)
Public propertyConnectionID
Gets a value that identifies the web site.
(Inherited from CSDocumentInformation.)
Public propertyContent
Gets a value that specifies the content to save.
(Inherited from CSDocumentInformation.)
Public propertyContentLoaded
Gets a value that indicates what Content has been loaded.
(Inherited from CSDocumentInformation.)
Public propertyContentType
Gets the content type (Mime type) of a document.
(Overrides CSDocumentInformationContentType.)
Public propertyCreatedDate
Gets a value that indicates when a document was created.
(Inherited from CSDocumentInformation.)
Public propertyCreatorName
Gets the name of the person that created the document
(Inherited from CSDocumentInformation.)
Public propertyDocumentFileNamingConvention
Gets the document filenaming convention.
(Overrides CSDocumentInformationDocumentFileNamingConvention.)
Public propertyDocumentID
Gets a value that specifies the id of a document. Default value is zero.
(Inherited from CSDocumentInformation.)
Public propertyDocumentName
Gets a value that specifies the name of the document.
(Inherited from CSDocumentInformation.)
Public propertyDocumentType
Gets a value that indicates the type of document loaded.
(Inherited from CSDocumentInformation.)
Public propertyEditTemplateId
Gets a value that defines the Edit template in use by a Presentation template.
(Inherited from CSDocumentInformation.)
Public propertyEncoding
Gets the document encoding.
(Inherited from CSDocumentInformation.)
Public propertyExistsDraft
Gets a value indicating whether there is a draft content for this document.
(Inherited from CSDocumentInformation.)
Public propertyFileExtension
Gets a value that specifies the file extension of the document.
(Inherited from CSDocumentInformation.)
Public propertyFileName
Gets or sets a value that specifies the file name of a document.
(Inherited from CSDocumentInformation.)
Public propertyFileSize
Gets a value that indicates the size (in bytes) of the document stored on disc.
(Inherited from CSDocumentInformation.)
Public propertyGuoid
Gets a value that specifies a unique identifier from a copied document.
(Inherited from CSDocumentInformation.)
Public propertyHeaderData
Gets a value that indicates the header data.
(Inherited from CSDocumentInformation.)
Public propertyIntroduction
Gets a value that indicates the introduction content.
(Inherited from CSDocumentInformation.)
Public propertyIsApproved
Gets a value that indicates whether the loaded content is approved (published) or not.
(Inherited from CSDocumentInformation.)
Public propertyIsCheckedOut
Gets a value that indicates whether the document is checked out or not.
(Inherited from CSDocumentInformation.)
Public propertyIsCheckedOutByCaller
Gets a value that indicates whether the document is checked out by the caller or not
(Inherited from CSDocumentInformation.)
Public propertyIsDataLoaded
Gets a value that indicates whether data has been loaded from database or not.
(Inherited from CSDocumentInformation.)
Public propertyIsDeleted
Gets a value that indicates whether the document is deleted (thrown in the recycling bin) or not.
(Inherited from CSDocumentInformation.)
Public propertyIsDirty
Gets a value that specifies whether any updatable properties of the document has been changed.
(Inherited from CSDocument.)
Public propertyIsLive
Gets a value that indicates whether the document is published and exists in a "live" version.
(Inherited from CSDocumentInformation.)
Public propertyIsOnVersioning
Gets a value that indicates whether the document is sent for versioning or not.
(Inherited from CSDocumentInformation.)
Public propertyIsRejected
Gets a value that indicates whether the document has been sent for versioning and later rejected or not.
(Inherited from CSDocumentInformation.)
Public propertyKeywords
Gets a value that indicates a list of keywords for the document.
(Inherited from CSDocumentInformation.)
Public propertyLastCheckedOut
Returns when the document was last checked out.
(Inherited from CSDocumentInformation.)
Public propertyMarking
Gets a value that specifies a short description of the document.
(Inherited from CSDocumentInformation.)
Public propertyMaxContentSize
Gets the maximum size of the content allowed.
(Inherited from CSDocumentInformation.)
Public propertyMenuData
Gets a value that specifies a user defined data for menu items.
(Inherited from CSDocumentInformation.)
Public propertyMenuTarget
Gets a value that specifies the user defined target for menu items. Only applicable if the document acts as a menu node.
(Inherited from CSDocumentInformation.)
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.
(Inherited from CSDocumentInformation.)
Public propertyMLCProperties
Gets MLC information about the current document.
(Inherited from CSDocumentInformation.)
Public propertyModifiedBy
Gets the name of the person that made the last saved change of the document.
(Inherited from CSDocumentInformation.)
Public propertyModifiedDate
Gets a value that indicates when a document was modified.
(Inherited from CSDocumentInformation.)
Public propertyOrderInHierarchy
Gets a value that specifies the order in a document hierarchy.
(Inherited from CSDocumentInformation.)
Public propertyParentDocumentID
Gets a value that specifies the parent document for a document
(Inherited from CSDocumentInformation.)
Public propertyPublishDate
Gets a value that specifies the publish date of the document.
(Inherited from CSDocumentInformation.)
Public propertyPublished
Gets a value that specifies whether the document should be published or not.
(Inherited from CSDocumentInformation.)
Public propertyReadOnly
Gets a value that indicates whether the Content Studio document can be saved or not.
Public propertySessionID
Gets a value that identifies the caller's session. This value typically is retrieved from a call to the OpenSession method of the AuthenticationBase class
(Inherited from CSDocumentInformation.)
Public propertyVersionNumber
Gets a value that indicates the versioning number of the most recent published version of the document
(Inherited from CSDocumentInformation.)
Public propertyVersoningStatus
Gets a value that indicates the versioning status of the document
(Inherited from CSDocumentInformation.)
Public propertyVirtualPath
Gets the virtual path of this document.
(Inherited from CSDocumentInformation.)
Top
Methods

  NameDescription
Public methodApprove
Approves a saved document, and reloads it with new properties.
Public methodChangeOrderInHierarcy
Sets the order among siblings within a hierarchy.
Protected methodCheckIn
Checks in the document.
Protected methodCheckOut
Checks out the document.
Public methodClose
Closes the object by checking it in and resets all data to their initial values.
Public methodConnectToParent
Connects the document to a another document and makes it a part of a document hierarchy.
Public methodDisconnectFromParent
Removes the document from a document hierarchy.
Public methodEquals (Inherited from Object.)
Protected methodFinalize
Releases unmanaged resources and performs other cleanup operations before the CSSyncronizedDocument is reclaimed by garbage collection.
(Overrides ObjectFinalize.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodLoad
Loads data from the underlying database.
(Inherited from CSDocumentInformation.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodSave
Saves changes to a loaded and writable document that has been changed.
Public methodSave(Int32)
Saves changes to a loaded and writable document that has been changed.
Protected methodSetDefault
Resets all values to their default values.
(Inherited from CSDocumentInformation.)
Protected methodSetDirty
Sets the IsDirty property to a new value.
(Inherited from CSDocument.)
Protected methodSetDocumentId
Sets the DocumentID property if un-assigned.
(Inherited from CSDocumentInformation.)
Public methodSyncronizeFile
Synchronizes the content of the document with the its file system representation.
Public methodSyncronizeFile(Boolean)
Synchronizes the content of the document with the its file system representation and optionally synchronizes the file permissions.
Public methodToString (Inherited from Object.)
Top
Remarks

There are two constructors for this class, one that opens an existing document and one that creates a new document:
ConstructorPurpose
CSSyncronizedDocument(ConnectionId, SessionId, CategoryId, String)Creates a new document that can be updated and published.
CSSyncronizedDocument(ConnectionId, SessionId, DocumentId, CSDocumentInformationContentToLoad)Opens an existing document. The document might or might not be possible to change depending in the version of the document loaded.

When created CSSyncronizedDocument has the following characteristics

  • When opened in writable mode, the document is checked out automatically. In order to ensure that the document is released and checked in correctly you should call the Close method after that you are finished with the CSSyncronizedDocument instance. Alternatively , since CSSyncronizedDocument implements the IDisposable interface you can wrap the CSSyncronizedDocument instance in a using block which will automatically close the object when it goes out of scope.
  • Uploaded files cannot be updated using this object.
  • If you are working with EPT documents you will most certainly find the SyncronizedEPTDocument object more appropriate when you need to update their content.
Examples

The following sample shows how to create a new Content Studio document, set some properties and eventually save it. The new document is also created as a child document of the current document. The example only works within Content Studio.

Note
The code uses thoroughly implemented exception handling in order to ensure that the object is released properly.

CSSyncronizedDocument synDoc = null;
try
{
   synDoc = new CSSyncronizedDocument(CS_ConnectionId, CS_UserSessionId, CS_InsertedCategoryId, "The child document");
   synDoc.Content = "<h1>This is a new document</h1>";
   synDoc.ParentDocumentID = CS_InsertedDocumentId;
   //Save the new document
   synDoc.Save();
   Response.Write("<h1>The child document has successfully been created. New id is: " + newDoc.DocumentID.ToString() + "</h1>");
}
catch (Exception ex)
{
   Response.Write("<h1>Could not create a child document: " + ex.Message + "</h1>");
}
finally
{
   //Make sure that the document is released!
   if(synDoc != null) 
      synDoc.Close();
}
The next example shows how simple it is to create a new document in the current category and copy the content and the header into the newly created document. For this purpose you can use a combination of the CSDocumentInformation and the CSSyncronizedDocument objects. The example only works within Content Studio and uses a using block to make sure that the resources are freed correctly before the object goes out of scope.

try
{
  //Create a new instance of the CSDocumentInformation object to get the current documents properties.
  //If reading is the only operation to make, CSDocumentInformation is more efficient since no check in/out operations will be performed.
  CSDocumentInformation DocInfo = new CSDocumentInformation(CS_ConnectionId, CS_UserSessionId, CS_InsertedDocumentId, CSDocumentInformation.ContentToLoad.Draft);
  //Create a copy of the document, name it the same as the document but prefix it with "Copy of ".
  using (CSSyncronizedDocument newDoc = new CSSyncronizedDocument(CS_ConnectionId, CS_UserSessionId, CS_InsertedCategoryId, "Copy of " + DocInfo.DocumentName))
  {
      newDoc.Content = DocInfo.Content;
      newDoc.HeaderData = DocInfo.HeaderData;
      newDoc.Save();
      newDoc.Approve();
      Response.Write("<h1>The document has successfully been copied. New id is: " + newDoc.DocumentID.ToString() + "</h1>");
  }
}
catch (Exception ex)
{
  Response.Write("<h1>Could not copy the document: " + ex.Message + "</h1>");
}
See Also

Reference