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.
Great post!
Thanks. I’ve got a prototype utility to automate this process that I plan to post when I take off a few more rough edges.
Hi Eugene,
Regarding your post about converting Sharepoint’s list template manifest.xml to a schema.xml (date September 27, 2006), i’ve tried creating a schema.xml to be used on a simple feature which basically makes the above list template available.
I’ve been able to create and deploy the feature, based off the custom list feature.
I’ve tried your “recipe” to generate the schema.xml but i’m getting errors creating a list based off the template/feature.
BTW, i’m using Sharepoint 2007 RTM.
Maybe they changed something on the XML schemas from beta2 ?
Regards,
Nuno Leong
Thanks for the comment. I should have clarified in my post that these steps were intended for WSS 2 / SPS 2003. I have not tried this yet in WSS 3 / MOSS 2007.
After just a cursory look through some WSS 3 list definitions, I can see that there is a new element “/List/MetaData/ContentTypes” that I made no mention of in my post.
I have heard, but not seen or tried, that in WSS 3 there is some way to create a site / list definition from an existing site, similar to what I posted about for WSS 2 / SPS 2003. Again, I have not seen or tried this so I can’t even say for sure that it exists. I’m just passing along what I’ve heard.
Well, I think that’s a long-winded enough reply to your comment :). If I get the time I will expand on this comment as another post.
Hi there, I know this post is a few years old now, but in case someone stumbles across it (like me) who needs to do this with MOSS 2007, good news! It worked just fine, with a few caveats.
First, I could not find a /List/MetaData/DefaultDescription element in my manifest.xml, so I skipped this step (step 4).
Second, the <List> element (the root element in schema.xml) is not the root element in manifest.xml. Manifest.xml's root element is <ListTemplate>. The <List> element is located at /ListTemplate/UserLists/List. So all I had to do was remove the extra stuff, leaving only the <List> element and all its contents.
I've only just started my research into the best way to do this, so there may be a better way that I don't know about yet. But, having stepped through this with MOSS 07, I thought it might be useful to share that it does work, with just a few extra steps.
Thanks!
SW, Thanks for the comment! I have had people periodically ask me about how to apply this post to WSS V3 / MOSS 2007, but I have not had time to test it out myself.
hello eugene,
I want to upload a site template of one sharepoint site to another site. Can u please tell me what changes will i have to make in manifest.xml file?
Not a simple question to answer. If the other site / site collection does not have the same features enabled, the same site columns, site content types, you could be in for a level of effort close to creating a site definition.