I have a scenario where a number of files have been uploaded into SharePoint, and all files have been applied with a generic content type 'Legacy Document'.

I need to programatically change the content type when a user checks out the document / or the user selects 'edit properties' prompting the file to be checked out.

I'm struggling to change the content type using the ItemCheckingOut event, I'm essentially trying to intercept the call, change the CT so the user sees the correct fields on the edit properties page.

When using the ItemCheckoutEvent, there are no 'afterproperties' for me to use, so I'm trying to first checkout the file, update the properties, then systemUpdate, but this is causing numerous failures (save conflicts).

I don't have the option to bulk update all files, as only files that are being editing should have the updated content type.

Force check-out is enabled on the library.

Any ideas how I can achieve this?


1 Answer 1


This is possible in Content editor webpart. You can add the following sample code ( below ) to content editor webpart in edit form. Replace contenttypeId with your contentId that you want to change it to...

    <script type="text/javascript">
    var contenttypeId="0x0101008200F1B7E083E64F8536ECBF22B6571C00BE6AE4B6FAAEE24BB906F960C9D5FECE";
       function func1(){ 
       if(jQuery("select[title='Content Type']").val() != contenttypeId){
        jQuery("select[title='Content Type'] option:selected").removeAttr("selected");
        jQuery("select[title='Content Type'] option[value='"+contenttypeId +"']").attr('selected', 'selected'); 
        jQuery("select[title='Content Type']").trigger("change");

    ExecuteOrDelayUntilScriptLoaded( func1 ,'core.js');


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.