Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

JavaScript Create List Item with Content Type Fails with Invalid Request

$
0
0

I'm trying to create an item in a task list. 

function CreateTask() {
    console.log('Creating Task');
    var clientContext = new SP.ClientContext.get_current();
    var oList = clientContext.get_web().get_lists().getByTitle('Workflow Tasks');
    clientContext.load(oList);
    var itemCreateInfo = new SP.ListItemCreationInformation();
    this.oListItem = oList.addItem(itemCreateInfo);

    oListItem.set_item('Title', 'Read Notification: Javascript');
    oListItem.set_item('Body', 'Hello World!');
    oListItem.set_item('ContentType', 'Mark As Read');
    oListItem.update();

}

I keep getting the following error:

If I comment out the Content Type it works.


David Jenkins


Viewing all articles
Browse latest Browse all 7589

Trending Articles



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