Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: Odd: Can't add columns to a list

$
0
0
Oli:

I just ran this code and it worked. Note that I have the AddList operation commented out because I wanted to run UpdateList several times to make sure that I could add columns repeatedly.
  $(document).ready(function() {

    //Create list
    /* $().SPServices({
        operation: "AddList",
        listName: "foo",
        description: "List created for quiz: foo",
        templateID: 100
    });
    */
    //Add field: Score
    var nfields = "<Fields><Method ID='1'><Field Type='Text' DisplayName='DayCount2' ResultType='Text'></Field></Method></Fields>";
    $().SPServices({
        operation: 'UpdateList',
        listName: "foo",
        newFields: nfields,
        completefunc: function(xData, Status) {
            tp1 = xData.responseText;
            alert(tp1);
            tp4 = tp1.indexOf("errorstring");
            if (tp4 < 0) {
                alert("Fields created!");
            }
            else {
                // Error creating fields!
                alert("Error creating fields!");
            }
        }
    });

});

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>