I have a library where a customized SPFolder content type is defined. When I use the following code in generating the folder I'm perfectly able in creating one.

However, I seem to be unable in using the base 0x0120 SPFolder content type. It automatically creates a folder with the customized content type instead of the base "Type": "SP.Folder" I'm specifying. Trying to use a MERGE REST to modify the contenttypeid also doesn't work. I also seem unable to touch the contenttypeid property, REST forces me to use the "Type" property. Why!???

        var foldername = folderurl;

            url: "url",
            method: "POST",
            body: "{ '__metadata':{ 'type': 'SP.Folder' }, 'ServerRelativeUrl':'" + foldername + "' }",
            headers: {
                "accept": "application/json; odata=verbose",
                "content-type": "application/json; odata=verbose"
  • Have you tried specifying ContentTypeId in the body? – wjervis Oct 7 '14 at 17:02
  • Yeah, it starts complaining it needs to be included in __metadata. – Christoffel de Gruyter Oct 8 '14 at 7:46

Since Folder resource does not expose Content Type property I would recommend you to create Folder using SharePoint 2010 REST endpoint, in that case Content Type could be specified as demonstrated below:

function createFolder(webUrl,listName,folderUrl,folderContentTypeId, success, error) 
     var urlParts = folderUrl.split('/');
     var folderPath = urlParts.slice(0, urlParts.length - 1).join("/");
     var folderName = urlParts[urlParts.length - 1];

     var folderPayload = {
        'Title' : folderName,
        'Path' : folderPath

           url: webUrl + "/_vti_bin/listdata.svc/" + listName,
           type: "POST",
           contentType: "application/json;odata=verbose",
           data: JSON.stringify(folderPayload),
           headers: {
              "Accept": "application/json;odata=verbose",
              "Slug": folderUrl + "|" + folderContentTypeId
           success: function (data) {
          error: error


How to create a Folder named Orders in Documents library at the web site /Archive:

        console.log('Folder ' + folder.Name + ' has been created succesfully'); 

Advantages: compatible with SharePoint 2010/2013 REST Interface


Files and folders REST API reference

  • ¿Is posible to create it with content type name? – Mikel Sep 22 '17 at 6:54

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.