I am making a SharePoint app with javascript.

I am trying to add a list item to a list I have defined in Visual Studio. I have done this just by adding a list in the solution explorer, and I made some custom columns in the graphical view. This is actually where I suspect my error could be located. Is this how I define my columns? My code looks like this

var oListItem = null;
function createListItem() {
    var oList = clientContext.get_web().get_lists().getByTitle('List');
    var itemCreateInfo = new SP.ListItemCreationInformation();
    oListItem = oList.addItem(itemCreateInfo);
    oListItem.set_item('Car', 'My New Item');

        Function.createDelegate(this, onQuerySucceeded),
        Function.createDelegate(this, onQueryFailed)

function onQuerySucceeded() {
    alert('Item created: ' + oListItem.get_id());

function onQueryFailed(sender, args) {
    alert('Request failed. ' + args.get_message() +
        '\n' + args.get_stackTrace());

I am able to print out the list and the fields, but I am not able to add the item like this. I get an error telling me:

Request failed. Column 'Car' does not exist. It may have been deleted by another user.

What can I do to be able to add some items to my list? Do I have to define my list otherwise?


The code should work I think. You haven't just changed the Title field to Car ? If so, the internal name of the column is still Title, and you need to use that:

oListItem.set_item('Title', 'My New Item');

If not, double check that the internal name of the field is actually Car

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.