How to use Content Service API in Umbraco CMS

Umbraco is open source Content Management System ( CMS ) for managing dynamic content on any site. It is managing content from admin panel and display on the front side. It is very easy to create content from admin panel. Sometimes we need to create content from a front side. For example, we need to save testimonials for the site then it will be submitted from a front side. In this case, we need to save content from the front end. Umbraco CMS also provide us Content Service API to manage content. We can use that content service API to create content from front-end side.

There are some steps to create content using Content Service API.

  • Create surface Controller.
  • Add method for creating content.
  • Set generic properties of the content.
  • Add method in Umbraco form.

For Example, If we need to add testimonials data in our site then, First of all, we need to create Surface Controller in Umbraco CMS project. Then we need to add method as below to add testimonial data in Umbraco CMS site. We need to set the value of generic properties which we had defined while creating document type of testimonials.

Hire Now!

Do You Need Help From Our Dedicated Umbraco CMS Developer for Hire?

Hire our best Umbraco CMS developer on hourly, Full-time, Part-time bases. We are ready to help you resolve the problems for Umbraco CMS web app development.
Hire Now!
public ActionResult AddTestimonial(string Name = "", string Description = "")
var contentService = new ContentService();
var user = contentService.CreateContent(
Name, // Node Name - what I want to call the new child node
1115, // Parent Node we want to add to
"umbTestimonial", // The alias of the Document Type
0); // Umbraco User ID this will be created by, default 0
user.SetValue("name", Name);
user.SetValue("description", Description);
return this.Redirect("/testimonial-list");

Now, We can post the data using BeginUmbracoForm method of Umbraco cms.

@using (Html.BeginUmbracoForm("AddTestimonial", "TestimonialSurface", FormMethod.Post))
//add your form code here

I hope that this article will make your Umbraco CMS integration as easy as. get in touch, if you would like to support in Umbraco CMS development. You may also Hire Umbraco CMS Developers from our company for Help and Supports.

By | 2017-09-20T11:50:58+00:00 October 11th, 2014|Content Management System, How To|