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.
Sitefinity CMS allows you to delete events through the Events API.
When deleting an event, you must perform the following:
To delete an event you can use the Native API or the Fluent API.
NOTE: The code examples below work with the ID of the master version of the event. Deleting the master version also deletes the other versions of the item. For more information about deleting items using the ID of the live version, see For developers: Delete content.
The following examples delete an event by the ID of its master version:
Native API
First, you initialize the EventsManager. Then, you get the master version of the event using GetEvents and filtering based on the Id property. To delete the event, you call the DeleteEvent method passing the master version as argument. Finally, you save the changes.
EventsManager
GetEvents
Id
DeleteEvent
Fluent API
First, you initialize the plural facade of the event using App.WorkWith().Events(). Then, you filter based on the Id property to assure that the event exists. To get the master version of the event, you use the singular facade of the event.
App.WorkWith().Events()
NOTE: If there is no event with the specified Id, Event(masterEventId) throws an exception of type ItemNotFoundException.
Event(masterEventId)
ItemNotFoundException
To delete the event, you use the Delete method of the facade. Finally, you save the changes.
Delete
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