Sitefinity CMS allows you to query for a specific event by its ID. To search for specific events based on any other property or criteria, see For developers: Find events.
NOTE: The code examples below work with the ID of the master version of the item and return the live version of the item. For more information about other scenarios, see For developers: Query master and live versions.
When querying the live version of a specific event by the ID of its master version, you must perform the following:
NOTE: The live version is used only when displaying the event in a front-end scenario. To modify the event, consider using the master version. To transfer the changes to the live version, publish the master version.
The following examples query the live version of an event by the ID of its master version:
First, you get an instance of the EventsManager class. You get the specified event by querying all items and filtering the collection by the ID of the event. If the item exists, you get its live version. If no live version exists (i.e. the event has not been published), null is returned. Finally, you return the event.
To find the event, you can also use the GetEvent method passing masterEventId:
NOTE: Calling GetEvent(masterEventId) throws an exception of type ItemNotFoundException, if there is no event with the specified Id.
First, you use the plural facade of the event to assure that the event with the specified Id exists. Then, you use the GetLive method of the singular facade to get the instance of the live version. Finally, you return the event.
When querying all events, you must perform the following:
The following code queries all events:
First, you get an instance of the EventsManager class. You query all events, including the live, master and temp versions of each. You filter the collection based on the Status property to return only the live versions. Finally, you return the events.
First, you get an instance of the plural facade of the event. Then, you get all events, including the live, master and temp versions of each. You filter the collection based on the Status property to return only the live versions. Finally, you return the events.
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 © 2023 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