Create a news item with the Fluent API
Use the code example below to create a news item and to set its ID, Title, and Content with the Fluent API.
NOTE: The ID argument is assigned to the master version of the news item. For more information about the different version of a news item, see For developers: Content lifecycle.
In the example below, you perform the following:
- Check whether a news item with the same ID already exists.
- If it does not exist, create the news item by calling the CreateNew method of the singular news item facade.
The ID argument is assigned to the ID master version of the item.
- Set the properties of the news item by calling the Do method of the facade.
- Save the changes.
- To publish the news item, call the MessageWorkflow method of the WorkflowManager class and pass the required parameters.
- Create a news item with the Fluent API