1

I am trying to create a new Document Library using the SharePoint Lists web service. I can create a generic Document Library using the below SOAP:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:AddList>
         <soap:listName>TestLibrary</soap:listName>
         <soap:templateID>101</soap:templateID>
      </soap:AddList>
   </soapenv:Body>
</soapenv:Envelope>

However, our site admin has created custom Document Library templates that I am supposed to use. My question is, how do I create a Document Library in SharePoint using a custom Document Library template with web services? I'm assuming I would need to find out the Template ID, but I'm not sure how to find this. Or is there another way?

FYI, I found a list of standard template types here.

  • 1
    Was this a template deployed as a feature or one saved as a template through the UI? – Eric Alexander Apr 25 '14 at 0:48
  • I'll have to check with the admin to be sure, but I believe it was saved as a template through the UI. – lamarvannoy Apr 25 '14 at 2:27
  • Yes, a .stp file was loaded as a list template through the UI. – lamarvannoy Apr 25 '14 at 12:26
2

How to identify List Template ID in List Template file (stp)

  • Download .stp file
  • Rename the .stp file extension to .cab file
  • Open and extract the contents of .cab file, the stp configuration will be specified in a manifest.xml file within that cab file
  • Open manifest.xml file and find TemplateType element, value of which corresponds to Template ID
  • Thanks for the response, it helped me to my solution. I would up-vote you if I had enough rep! – lamarvannoy Apr 26 '14 at 20:27
  • Glad this helped you :) – Vadim Gremyachev Apr 26 '14 at 20:30
1

I resolved this and wanted to document the answer here for completeness. You need two pieces of information to add a SharePoint Document Library or List following a custom template:

  • Feature ID
  • Template ID

This information can be found in one of two ways:

  1. If the template was loaded by using an .stp file, you can follow the steps in Vadim Gremyachev's answer on this page to obtain the mainfest.xml with the information.
  2. Alternatively, you can manually create the custom List or Library in the UI and then query for it using the GetList web service which takes a single parameter: the list name. This will return a detailed response containing many details including the Feature ID and Template ID you need.

Once you have this information you can construct a web service call to the AddListFromFeature web service. The example below will create a default Document Library. Replace the Feature ID and Template ID with the values you obtained in the previous step:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:AddListFromFeature>
         <soap:listName>New Document Library</soap:listName>
         <soap:featureID>00BFEA71-E717-4E80-AA17-D0C71B360101</soap:featureID>
         <soap:templateID>101</soap:templateID>
      </soap:AddListFromFeature>
   </soapenv:Body>
</soapenv:Envelope>
  • can you share code snippet? – Gennady G Dec 1 '17 at 22:21

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.