2

I have created a list in sharepoint 2010 and want to somehow export the list definition for use in a feature in visual studio 2010. What is the best approach to getting the list definition?

2 Answers 2

2

If you've created the list in the web interface, save the site as a template, which will download it as a WSP package. In Visual Studio, create a new project and select the project template which creates a project from a WSP file, it's somewhere under SharePoint in "New Project" template selection.

There you can dig out all the definitions for that site and pull out your List Definition for use elsewhere.

4
  • wsp files imports list instance not list definition. that's not what is asked about
    – Jedistan
    Commented Jun 25, 2012 at 14:33
  • WSP can contain both list defs and instances.
    – SPDoctor
    Commented Jun 25, 2012 at 14:41
  • 1
    @SPDoctor - nope, if the list was initially created and customized though the browser, the wsp will contain a list instance using the list template originally used(most likely, 'custom list') and a custom schema attached. Not exactly the same thing but could work if the OP's users will not be creating new lists from these list definitions. Commented Jun 25, 2012 at 18:54
  • What I mean is that a WSP can contain both - of course what is in a particular WSP depends on how it was created.
    – SPDoctor
    Commented Jun 26, 2012 at 11:56
0

If you just need to provision a customized list, James Love's solution above will do the trick. If you need to create actual list templates that users can use to create new lists off of, you'll need to create a new list definition.

The easiest way to do this is to get your content type from the wsp site template, add that into your Visual Studio project, and add a new item of type "List definition from Content Type", using the content type you just added.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.