Content Studio Web Content Management System
SystemObject
ContentStudio.DocumentCSDocument
ContentStudio.DocumentCSDocumentInformation
ContentStudio.DocumentCSSyncronizedDocument
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
Top
Top
Top
There are two constructors for this class, one that opens an existing document and one that creates a new document:
When created CSSyncronizedDocument has the following characteristics
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.
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.
[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
ContentStudio.DocumentCSDocument
ContentStudio.DocumentCSDocumentInformation
ContentStudio.DocumentCSSyncronizedDocument
Namespace: ContentStudio.Document
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
Syntax
The CSSyncronizedDocument type exposes the following members.
Constructors
Name | Description | |
---|---|---|
CSSyncronizedDocument(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.
| |
CSSyncronizedDocument(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.
| |
CSSyncronizedDocument(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.
|
Properties
Name | Description | |
---|---|---|
AllowedFiletypes |
Gets the file extensions allowed for this document.
(Overrides CSDocumentInformationAllowedFiletypes.) | |
ApprovedDate |
Gets a value that indicates when the most recent published version document published.
(Inherited from CSDocumentInformation.) | |
Approver |
Gets the name of the person that published the most recent version of the document.
(Inherited from CSDocumentInformation.) | |
ArchiveDate |
Gets a value that specifies the archive date of the document.
(Inherited from CSDocumentInformation.) | |
BodyProperties |
Gets a value that specifies the content of the document's BODY tag.
(Inherited from CSDocumentInformation.) | |
CanSetInitialPropertyValue |
Sets or gets a value that indicates whether initial document properties can be written or not.
(Inherited from CSDocumentInformation.) | |
CanSetPropertyValue |
Sets or gets a value that indicates whether updatable properties can be written or not.
(Inherited from CSDocumentInformation.) | |
CategoryID |
Gets that specifies the category of a document.
Default value is zero.
(Inherited from CSDocumentInformation.) | |
CheckOutBy |
Gets a value that indicates the name of the person that has the document checked out.
(Inherited from CSDocumentInformation.) | |
CheckOutById |
Gets a value that indicates the internal id of the caller that has checked out the document.
(Inherited from CSDocumentInformation.) | |
ConnectionID |
Gets a value that identifies the web site.
(Inherited from CSDocumentInformation.) | |
Content |
Gets a value that specifies the content to save.
(Inherited from CSDocumentInformation.) | |
ContentLoaded |
Gets a value that indicates what Content has been loaded.
(Inherited from CSDocumentInformation.) | |
ContentType |
Gets the content type (Mime type) of a document.
(Overrides CSDocumentInformationContentType.) | |
CreatedDate |
Gets a value that indicates when a document was created.
(Inherited from CSDocumentInformation.) | |
CreatorName |
Gets the name of the person that created the document
(Inherited from CSDocumentInformation.) | |
DocumentFileNamingConvention |
Gets the document filenaming convention.
(Overrides CSDocumentInformationDocumentFileNamingConvention.) | |
DocumentID |
Gets a value that specifies the id of a document.
Default value is zero.
(Inherited from CSDocumentInformation.) | |
DocumentName |
Gets a value that specifies the name of the document.
(Inherited from CSDocumentInformation.) | |
DocumentType |
Gets a value that indicates the type of document loaded.
(Inherited from CSDocumentInformation.) | |
EditTemplateId |
Gets a value that defines the Edit template in use by a Presentation template.
(Inherited from CSDocumentInformation.) | |
Encoding |
Gets the document encoding.
(Inherited from CSDocumentInformation.) | |
ExistsDraft |
Gets a value indicating whether there is a draft content for this document.
(Inherited from CSDocumentInformation.) | |
FileExtension |
Gets a value that specifies the file extension of the document.
(Inherited from CSDocumentInformation.) | |
FileName |
Gets or sets a value that specifies the file name of a document.
(Inherited from CSDocumentInformation.) | |
FileSize |
Gets a value that indicates the size (in bytes) of the document stored on disc.
(Inherited from CSDocumentInformation.) | |
Guoid |
Gets a value that specifies a unique identifier from a copied document.
(Inherited from CSDocumentInformation.) | |
HeaderData |
Gets a value that indicates the header data.
(Inherited from CSDocumentInformation.) | |
Introduction |
Gets a value that indicates the introduction content.
(Inherited from CSDocumentInformation.) | |
IsApproved |
Gets a value that indicates whether the loaded content is approved (published) or not.
(Inherited from CSDocumentInformation.) | |
IsCheckedOut |
Gets a value that indicates whether the document is checked out or not.
(Inherited from CSDocumentInformation.) | |
IsCheckedOutByCaller |
Gets a value that indicates whether the document is checked out by the caller or not
(Inherited from CSDocumentInformation.) | |
IsDataLoaded |
Gets a value that indicates whether data has been loaded from database or not.
(Inherited from CSDocumentInformation.) | |
IsDeleted |
Gets a value that indicates whether the document is deleted (thrown in the recycling bin) or not.
(Inherited from CSDocumentInformation.) | |
IsDirty |
Gets a value that specifies whether any updatable properties of the document has been changed.
(Inherited from CSDocument.) | |
IsLive |
Gets a value that indicates whether the document is published and exists in a "live" version.
(Inherited from CSDocumentInformation.) | |
IsOnVersioning |
Gets a value that indicates whether the document is sent for versioning or not.
(Inherited from CSDocumentInformation.) | |
IsRejected |
Gets a value that indicates whether the document has been sent for versioning and later rejected or not.
(Inherited from CSDocumentInformation.) | |
Keywords |
Gets a value that indicates a list of keywords for the document.
(Inherited from CSDocumentInformation.) | |
LastCheckedOut |
Returns when the document was last checked out.
(Inherited from CSDocumentInformation.) | |
Marking |
Gets a value that specifies a short description of the document.
(Inherited from CSDocumentInformation.) | |
MaxContentSize |
Gets the maximum size of the content allowed.
(Inherited from CSDocumentInformation.) | |
MenuData |
Gets a value that specifies a user defined data for menu items.
(Inherited from CSDocumentInformation.) | |
MenuTarget |
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.) | |
MenuURL |
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.) | |
MLCProperties |
Gets MLC information about the current document.
(Inherited from CSDocumentInformation.) | |
ModifiedBy |
Gets the name of the person that made the last saved change of the document.
(Inherited from CSDocumentInformation.) | |
ModifiedDate |
Gets a value that indicates when a document was modified.
(Inherited from CSDocumentInformation.) | |
OrderInHierarchy |
Gets a value that specifies the order in a document hierarchy.
(Inherited from CSDocumentInformation.) | |
ParentDocumentID |
Gets a value that specifies the parent document for a document
(Inherited from CSDocumentInformation.) | |
PublishDate |
Gets a value that specifies the publish date of the document.
(Inherited from CSDocumentInformation.) | |
Published |
Gets a value that specifies whether the document should be published or not.
(Inherited from CSDocumentInformation.) | |
ReadOnly |
Gets a value that indicates whether the Content Studio document can be saved or not.
| |
SessionID |
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.) | |
VersionNumber |
Gets a value that indicates the versioning number of the most recent published version of the document
(Inherited from CSDocumentInformation.) | |
VersoningStatus |
Gets a value that indicates the versioning status of the document
(Inherited from CSDocumentInformation.) | |
VirtualPath |
Gets the virtual path of this document.
(Inherited from CSDocumentInformation.) |
Methods
Name | Description | |
---|---|---|
Approve |
Approves a saved document, and reloads it with new properties.
| |
ChangeOrderInHierarcy |
Sets the order among siblings within a hierarchy.
| |
CheckIn |
Checks in the document.
| |
CheckOut |
Checks out the document.
| |
Close |
Closes the object by checking it in and resets all data to their initial values.
| |
ConnectToParent |
Connects the document to a another document and makes it a part of a document hierarchy.
| |
DisconnectFromParent |
Removes the document from a document hierarchy.
| |
Equals | (Inherited from Object.) | |
Finalize |
Releases unmanaged resources and performs other cleanup operations before the
CSSyncronizedDocument is reclaimed by garbage collection.
(Overrides ObjectFinalize.) | |
GetHashCode | (Inherited from Object.) | |
GetType | (Inherited from Object.) | |
Load |
Loads data from the underlying database.
(Inherited from CSDocumentInformation.) | |
MemberwiseClone | (Inherited from Object.) | |
Save |
Saves changes to a loaded and writable document that has been changed.
| |
Save(Int32) |
Saves changes to a loaded and writable document that has been changed.
| |
SetDefault |
Resets all values to their default values.
(Inherited from CSDocumentInformation.) | |
SetDirty |
Sets the IsDirty property to a new value.
(Inherited from CSDocument.) | |
SetDocumentId |
Sets the DocumentID property if un-assigned.
(Inherited from CSDocumentInformation.) | |
SyncronizeFile |
Synchronizes the content of the document with the its file system representation.
| |
SyncronizeFile(Boolean) |
Synchronizes the content of the document with the its file system representation and optionally synchronizes the file permissions.
| |
ToString | (Inherited from Object.) |
Remarks
Constructor | Purpose |
---|---|
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
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(); }
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