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.
To create a list you can use the Native API or the Fluent API.
When creating a list, you must perform the following:
Create new list.
First, you must create new list.
Set the required properties.
When creating a new list, it is recommended to set at least the following properties:
Title
Description
UrlName
DateCreated
You can also set any other properties in this step.
Save the list.
Save all changes that you have made to the list.
To create a list using the Native API, you must use the ListsManager class. For more information, see Creating a list using Native API.
To create a list using the Fluent API, you must use the list facade. For more information, see Creating a list using Fluent API.
The examples below show you how to create list with predefined ID.
The following code creates a list with the specified ID, Title and Description through the Native API.
First, you initialize the ListsManager. You create the list using the CreateList method of the ListsManager class. Note that you can create a list with either predefined or auto-generated ID depending on which overload of the method you use. Then, you set the properties of the list. It is recommended to set at least the following properties: Title, Description, UrlName and DateCreated. Finally, you save the changes.
The following code creates a list with the specified ID, Title and Description through the Fluent API.
First, you initialize the singular facade of the list by calling App.WorkWith().List(). You create the list using the CreateNew method of the facade. Then, you set the properties of the list by calling the Do method of the facade. It is recommended to set at least the following properties: Title, Description, UrlName and DateCreated. Finally, you save the 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