Sitefinity CMS allows you to modify a list item through the Lists API.
When modifying a list item, you must perform the following:
Get the master version.
Get the master version of the list item. When you modify a list item, you must not work on its live version.
For more information about querying list items, see For developers: Query list items
For more information about finding specific list items, see For developers: Find list items.
Get a temp version.
Check out the master version to get a temp version of the list item. This is the version you must modify.
Modify the temp version.
Use the temp version to modify the list item.
Update the master version.
Check in the temp version to transfer the changes to the master version.
Update the live version.
Publish the master version to transfer the changes to the live version.
The examples below modify a list item by the ID of its master version. For more information about working with the ID of the live version, see For developers: Edit content.
The following examples modify a list item by the ID of its master version.
First, you get an instance of the ListsManager class. Then, you get the master version corresponding to the ID.
Then, you call Lifecycle.CheckOut with the master version as argument to get a temp version of the item. You modify the content of the temp version with newContent. Then, you call Lifecycle.CheckIn with the temp version as argument to transfer the changes to the master version. By default, calling the CheckIn method deletes the temp version. Then, you call Lifecycle.Publish with the master version as argument to transfer the changes to the live version. Finally, you call SaveChanges to save all changes.
First, you check whether an item with the specified ID exists. Then, you get the master version with the specified ID using the singular facade of the list item.
NOTE: If there is no item with the specified Id, ListItem(masterListItemId) throws an exception of type ItemNotFoundException.
To get a temp for the item, you use the CheckOut method of the facade. Then, you modify the content with newContent in the Do method of the temp facade. You call CheckIn to transfer the changes to the master version of the item. Then, you call Publish to transfer the changes to the live version. Finally, you call SaveChanges to save all changes.
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
Copyright © 2020 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, Ipswitch, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.
Powered by Progress Sitefinity