Create a news item with the Native API

Use the code example below to create a news item and to set its ID, Title, and Content with the Native 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:

  1. Get an instance of the NewsManager class. 
  2. Check whether a news item with the same ID already exists. 
    If it does not exist, create the news item by calling the CreateNewsItem method of the NewsManager class. 
    You can create a news item with either predefined or auto-generated ID, depending which overload of the method you use. The ID argument is assigned to the ID property of the master version of the item. 
  3. Set the properties of the news item object.
  4. Save the changes. 
  5. To publish the news item in live state, call the MessageWorkflow method of the WorkflowManager class and pass the required parameters.

Create a news item with the Native API

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?