The goal here is to quickly back up a list as a template and from the manifest.xml file in the template to create a schema.xml file, which can be used in creating a site definition.
You'll need two files to get started. The first file is the manifest.xml file from the site or list template that has your current list structure. I'll refer to this file as the manifest. You'll also need the schema.xml file that corresponds to the list template from which the current list was created. I will refer to this file as the schema file. Also, unless I specify otherwise, all modifications will be done to the manifest file. The schema file belongs to SharePoint. The manifest file belongs to you.
Here are the steps required:
- Open the manifest file and convert all single CR characters to CR LF character combinations. If you open the file in Visual Studio 2005, Visual Studio will prompt you to make this change.
- Add the following text to the top of the manifest XML:
<?xml version="1.0" encoding="utf-8" ?>
<!-- _lcid="1033" _version="11.0.6451" _dal="1" -->
<!-- _LocalBinding -->
- Add xmlns:ows="Microsoft SharePoint" to /List element in the manifest file.
- Move /List[Description] attribute to /List/MetaData/DefaultDescription element
- Replace /List[Name] attribute GUID value with the value of /List[Title]
- Copy the /List/MetaData/Toolbar element from the schema file to the manifest file.
- Remove the /List/MetaData/Security element from the manifest file.
- Remove /List[Version] and /List[ServerTemplate] attributes
- Remove all /List/MetaData/Views/View[Name] attributes
- Add the WebPartZoneID="Main" attribute to all /List/MetaData/Views/View elements
- Convert the value of the /List/MetaData/Views/View[Url] attributes from site relative URLs to list relative URLs. For example, convert "Lists/Announcements/AllItems.aspx" to "AllItems.aspx".
- Copy /List/MetaData/Views/View[BaseViewID=0] from the schema file to the manifest file
- Replace the entire /List/MetaData/Forms element from the manifest with the /List/MetaData/Forms element from the schema file.
I'd like to hear from anyone who tries out these steps on their lists or who has done something similar. Thanks, and enjoy.