Create a Folder and set the ProgID programmatically using the SharePoint 2013 CSOM

Following up from my post:

Here is how to create a folder and set the ProgID on that folder in a library using the CSOM.

Setting the ProgID using the normal API isn’t supported as its read-only but luckily there is another way. (As there usually is with SharePoint 🙂 )

   1: //Set the ProgID - In this case its a OneNote notebook    

   2: listItem.set_item("HTML_x0020_File_x0020_Type", "OneNote.Notebook");

The function to a create a folder and set a ProgID is as follows. I haven’t included the Callback functions in the snippet but you get the idea.

   1: //Sets the ProgID

   2: function addFolderToLibrary(listName) {


   4:     var listItem;


   6:     //get the list details - assuming you have the spWeb context

   7:     var theList = spWeb.get_lists().getByTitle(listName);


   9:     //Set the list creation info        

  10:     var itemCreateInfo = new SP.ListItemCreationInformation();

  11:     itemCreateInfo.set_underlyingObjectType(SP.FileSystemObjectType.folder);

  12:     itemCreateInfo.set_leafName(clientName);


  14:     //Add the item

  15:     listItem = theList.addItem(itemCreateInfo);


  17:     //Set the ProgID - In this case its a OneNote notebook    

  18:     listItem.set_item("HTML_x0020_File_x0020_Type", "OneNote.Notebook");


  20:     //apply any updates

  21:     listItem.update();

  22:     clientContext.load(listItem);


  24:     //commit the  changes

  25:     clientContext.executeQueryAsync(

  26:         Function.createDelegate(this, onListUpdateSuccess),

  27:         Function.createDelegate(this, onListUpdateFail)

  28:     );


  30: }


About Aaron Saikovski

Aaron Saikovski is a Microsoft certified technology specialist, consultant, developer, trainer and cloud solution architect with over 20+ years commercial information technology experience. He has consulted and worked with an incredibly diverse number of both local and international clients across the banking and financial services, utilities, oil and mining, telecommunications, logistics, construction/property, pharmaceutical, transport/airline and FMCG sectors. He has also consulted on a variety of projects to both Federal and State governments in high-profile portfolios such as Prime Minister and Cabinet, Department of Defence, Taxation Office, Department of Education and Training, Department of Employment & Workplace Relations and the Department of Health. Aaron’s skills revolve around the Microsoft platform stack with a core skillset based on the SharePoint platform. He has been involved in some of the largest SharePoint deployments in the world and was a member of the Global SharePoint Ranger team within Microsoft Corporation and was actively involved with the SharePoint Customer Advisory Team (SPCAT) to provide guidance and best practices to the largest Microsoft enterprise global customers. He was also an active MSDN article reviewer and contributor during his time at Microsoft. He has very broad and deep experience with architecting, developing and deploying complex customer solutions leveraging the Microsoft Office365 and Azure cloud platforms. Some of the key cloud customers he has been involved with are Qantas, Caltex, and Fujitsu/Westpac to name a few. He assists customers with their journey to the cloud and provides guidance and best practices to assist in identifying workloads that are suitable candidates to be migrated or redeveloped. These include IaaS, SaaS and PaaS solutions that solve a particular business requirement while providing the best technical outcome for the customer. Aaron is a regular presenter at such events as SharePoint Saturday (, Microsoft TechEd and is a regular presenter at user groups and conferences. He presents on a wide and varied range of topics that encompass the complete end to end Microsoft solution stack such as Windows 8 App development through to deploying Azure IaaS solutions with PowerShell. Aaron has an active social media profile. He was the founding member of OzMoss (, a very active and prominent online SharePoint community and he can be followed on Twitter at @RuskyDuck72. He blogs regularly at Aaron is also an active affiliate member of the Institute of Electrical and Electronics Engineers ( Outside of work Aaron is a very active volunteer for DoggieRescue ( where he volunteers his time to maintain and improve their IT systems to keep them running as optimally and efficiently as possible. ** OPINIONS EXPRESSED ARE MY OWN VIEWS AND NOT THOSE OF MY EMPLOYER **
This entry was posted in CSOM, JavaScript, Office 365, SharePoint 2013, SharePoint Online. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s