IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
When editing a document, you must work with its master version. To modify a document, perform the following:
Get the master version. Get the master version of the document. When you modify a document, you must not work on its live version.
Get a temp version. Check out the master version to get a temp version of the document.
Modify the temp version. Set the properties of the temp version to the new values. You can also upload new document data.
Update the master version. To transfer the changes to the master version, check in the temp version .
Update the live version. To transfer the changes to the live version, publish the master version .
EXAMPLE: Modify a document by the ID of its master version. The example below shows how to modify a document by the ID of its master version. For more information about working with the ID of the live version, see For developers: Edit content and For developers: Content lifecycle. The following code modifies a document by the ID of its master version.
ID
Native API
First, you get an instance of the LibrariesManager class. Then, you get the master version with the corresponding ID. Then, to get a temp version of the document, you call Lifecycle.CheckOut with the master version as an argument. You make all the modifications to the temp version. In this example, you update the title of the document and its URL and upload new document data. Then, to transfer the changes to the master version, you call Lifecycle.CheckIn with the temp version as an argument. By default, when calling the CheckIn method the temp version gets deleted. To persist the changes, you call SaveChanges. Finally, to publish the master version, you call the MessageWorkflow method of the WorkflowManager class and pass the required parameters.
LibrariesManager
Lifecycle.CheckOut
temp
Lifecycle.CheckIn
CheckIn
SaveChanges
MessageWorkflow
WorkflowManager
Fluent API
First, you check whether a document with the specified ID exists. Then, you get the singular document facade of the master version with the specified ID. Then, to get the facade for the temp version, you call the CheckOut method. You make all the modifications in the Do method of the temp facade. In this example, you update the title of the document and its URL. To upload new document data, you call the UploadContent and pass the data as an argument. Then, to transfer the changes to the master version of the item, you call CheckIn. To save the changes, you call SaveChanges. Finally, to publish the document, you call the MessageWorkflow method of the WorkflowManager class and pass the required parameters.
CheckOut
Do
UploadContent
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important