Here's an obscure question for you all - I've got a pretty complex SPOL SP-hosted app that sets metadata for documents that are in a host web doc library. Metadata is set using jsom code in a custom 'set properties' page. One of the document attributes we're setting is content type. So the js code retrieves the selected content type id (from a drop-down we load with the list's content type names and guids) and after setting rather numerous other bits of metadata, does a set_item('ContentTypeID', {selected content type id}).

It works great for every file type EXCEPT xlsx and docx, where it refuses to save content type at all. I'm hoping maybe somebody has seen this, solved this before - code is like this:

 var contentTypeId = $jq("#content-type option:selected").val().toString();
 console.log("Content Type: " + contentTypeId);
        ...many other lines omitted here...
 document.set_item("ContentTypeId", contentTypeId);
 document.set_item("Title", DocumentTitle);

       function () {
           console.log("document updated");
           $jq("#progress-message").text("Document Updated Successfully.");
       function (sender, args) {...fail method continues here...}
  • Are you able to set content type for those files using out of the box edit properties form? Jan 9, 2015 at 22:13

1 Answer 1


yes. the out-of-the-box 'edit properties' form in the host web list works fine. It's just the javascript code in the app that does not set the content type for the docx and xlsx files. Code works for old doc and xls file formats, and all else. I know the metadata is written into the docx, xlsx. Using the ValidateUpdateListItem function fails also.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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