Create lists

To create a list you can use the Native API or the Fluent API.

When creating a list, you must perform the following:

  1. Create new list.

    First, you must create new list.

  2. 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.

  3. 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.

Creating a list using Native API

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.

Creating a list using Fluent API

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.

Was this article helpful?

Next article

Query lists