Sitefinity CMS allows you to modify an event through the Events API.
When modifying an event, you must perform the following:
The examples below modify an event 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 an event by the ID of its master version:
Native API
First, you get an instance of the EventsManager class. Then, you get the event corresponding to the ID. If the event exists, you get its master version by calling the Lifecycle.GetMaster method.
EventsManager
ID
Lifecycle.GetMaster
For more information about querying events, see For developers: Query events. For more information about finding specific events, see For developers: Find events.
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.
Lifecycle.CheckOut
newContent
Lifecycle.CheckIn
CheckIn
Lifecycle.Publish
SaveChanges
Fluent API
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 event.
NOTE: If there is no item with the specified Id, Event(masterEventId) throws an exception of type ItemNotFoundException.
Id
Event(masterEventId)
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.
CheckOut
Do
Publish
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.
This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important