Implementation

In my previous two articles you saw, how to:

  1. Create Site Columns On Host Web From App Web Using JavaScript In SharePoint 2013.
  2. Create Site Content Type In SharePoint 2013 using JSOM.

So, if you open the created Content type, you only see ‘Name’ and ‘Title’ fields there, which are basically added from Parent Content Types, now we will see how to add Site Columns to this Site Content Type present on Host Web from App Web.

 Content Types

We will perform following operations to achieve this:

  1. Get Host Web Context using App Web.
  2. Fetch already created Site Columns.
  3. Get the required Content Type from Host Web Content Type collection.
  4. Add Site Columns to this Content Type and update the Content Type.

Get Started:

Conclusion

Using this JSOM approach, you can add Site Columns to Content type on Host Web from App Web. You can use this approach to add columns to App web Content Type too.