How to create List and libraries with CustomSchemaXml property using SchemaXml with CSOM in sharePoint online2010????

I am using following Code...

// Create new list for restore List Item from List Schema XML
 ListCreationInformation listCreationInformation = new ListCreationInformation();
listCreationInformation.Title = "my_List_Name";
listCreationInformation.TemplateType = int.Parse(listServTemplate);
listCreationInformation.Description = listDescription;
listCreationInformation.QuickLaunchOption = QuickLaunchOptions.DefaultValue;
listCreationInformation.CustomSchemaXml = listCustomSchemaXml;//variable to store schemaXML as string reading schema.xml file

It is giving an exception "Invalid list template".

I am using ClientContext for user Authentication in CSOM.


You can figure out the xml by using Visual Studio. Add a list to a SharePoint project and then grab the schema.xml file.

You also need to provide the featureId of the list template.

I posted a full PowerShell remote provisioning example here: http://www.softlanding.ca/blog/remotely-provision-a-list-using-customschemaxml-(2)

|improve this answer|||||

Did You do some progress in this problem ? if no, please try:

  1. Change TemplateType to constant (e.g. 100 as BaseTemplate)
  2. Exclude CustomSchemaXml from your code and rerun program

to detect, which part of your solution is wrong.

My tests with copy lists from source to destination via schema XML strings shows, that sourcelist.CustomSchemaXml cannot be applied as is during creation of destinationlist.CustomSchemaXml. I had to remove many XML elements from source schema.

|improve this answer|||||

Had similar issue on SharePoint 2013. Please check the following when you want to specify custom schema XML:

  1. You have to specify correct list template TemplateType (like: 100, 101). Here is enumeration.
  2. IMPORTANT! You have to specify template feature ID property correctly. See this link, List of feature ID, listTemplate, where are listed all template types and their feature id's.
|improve this answer|||||

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.