This project has moved and is read-only. For the latest updates, please go here.

Adding a new column to multiple content types contained in a single list

Feb 5, 2015 at 9:03 PM
I have a script that is adding a column "Category" to a calendar list. I have accomplished this with SPServices (still the greatest tool to me since it's inception).

My problem is that the calendar contains multiple content types. What I need to happen is to add this column and have it added to all the content types (as can occur when you add a column through the interface and leave the "Add to all content types" and "Add to default view" boxed checked). Does this option exist in SPServices?

If not, is there a way to designate which content type I add the column to? If this is possible I could loop through and add it to each.

Please note that I am writing this script for SharePoint 2007 but I will need to make it work in 2010 in the near future.

Here is a snippet of the code to add the column:
function addNewCategoryField(){
   var fields = '<Fields>';
   fields += '<Method ID="1"><Field Type="Choice" Name="Category" DisplayName="Category">';
   fields += '<CHOICES>';
      fields += '<CHOICE>' + arrayContentType[i] + '</CHOICE>'; // adding choices to match Content Types
   fields += '</CHOICES>';
   fields += '</Field>';
   fields += '</Method>';
   fields += '</Fields>';


function doUpdateList(fields){

   if(isCategoryPresent){ // elsewhere in my code this checks to see if the Category field already exists
      fieldsToUpdate = fields;
      fieldsToAdd = "";
      fieldsToUpdate = "";
      fieldsToAdd = fields;
      operation: "UpdateList",
      listName: curListGUID,
      updateFields: fieldsToUpdate,
      newFields: fieldsToAdd,
      deleteFields: "",
      listVersion: "",
      async: false,
      completefunc: function (xData, Status){
         if(Status == 'success'){
Apr 19, 2015 at 5:10 PM
Hi Den,

I am experiencing a similar issue. However, I would like to add a new field to a list but not add it to the default content type. Please let me know if you have figured out the solution. Might help me as well.

Apr 29, 2015 at 2:07 PM
You should be able to add a column to the list with UpdateList. (It sounds like neither of you want to add the column to any of the applied Content Types.)

If you do want to add the column to a specific Content Type, then you should probably use UpdateContentType.