Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

In my SharePoint-hosted app, I use javascript to apply a content type called "Order" to a list in my app.

When users click "new item" to upload a document, I want that document to derive from my new content type.

Is it possible to programmatically change the content type order to make this "Order" content type the default one? This can of course be done in the GUI, but I need to do it via script.

share|improve this question

1 Answer 1

Check this MSDN page: How to: Complete basic operations using JavaScript library code in SharePoint 2013 and look at the paragraph Update a list item

Example for update title from MSDN:

oListItem.set_item('Title', 'My Updated Title');

Change content type for current item (simply):

oListItem.set_item('ContentTypeId', 'your_CTID');
// example
oListItem.set_item('ContentTypeId', '0x010100151C2776E89042529ECEA9A8E1BD6A1D');
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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