locked
Create list using custom template using the client object model RRS feed

  • Question

  • I'm trying to create a nwe document library using a list template. I've created the list template and saved it to list template gallery.

    This is the code I'm using to create the library:

    listTemplate lt = listTemplates[0];
    listCreate.Title = name;
    listCreate.Url = url;
    listCreate.Description = description;
    
    listCreate.TemplateType = lt.ListTemplateTypeKind;
    listCreate.TemplateFeatureId = lt.FeatureId;
    listCreate.CustomSchemaXml = GetCustomSchemaXml();        
    
    salesWeb.Lists.Add(listCreate);
    clientContext.ExecuteQuery();
    

    The method GetCustomSchemaXml is returning the schema, as a string, extracted from the manifest.xml file which is in the stp-file. the custom schema is the <List>-tag of that file. The error I'm getting is the same as in this thread here;

    "Server Out Of Memory. There is no memory on the server to run your program. Please contact your administrator with this problem."

    Any thoughts on what be the cause of this?

    Wednesday, January 26, 2011 11:51 AM

Answers

All replies

  • Hi flowjob,

     

    Thanks for your post.

    You cannot create list using the custom template using Client OM. Instead, you can create a custom list definition,  and then create list based on this definition.

    More information about Create List using Client Object Model:

    http://blogs.technet.com/b/speschka/archive/2009/11/01/using-the-sharepoint-2010-client-object-model-part-4.aspx

    • Marked as answer by KeFang Chen Thursday, February 3, 2011 2:43 AM
    Tuesday, February 1, 2011 3:58 AM
  • Hi flowjob!

    Have you been able to create a list from custom template using Client OM?

    Thanks

    Thursday, November 1, 2012 8:38 AM
  • Hi,

    it's an old topic but here are my findings.

    I was able to find a custom list template via CSOM on SP2013 and create the list based on that but the new list didn't have the settings and views from the template. But it had them when I used the custom template via GUI…

    Monday, January 11, 2016 11:48 AM