Geeks With Blogs
Scott Van Vliet Once a Developer, Always a Developer

Update 2010-03-23 – Sorry, but the images and downloads were hosted on a server that is no longer available.  I will try to find the sample code bits and images on a backup sometime!

Lists created in WSS can be used inside of an SPS Area. However, the file created for the List template (.stp file) contains metadata describing which Site Definition the list should use in order to find its own List Definition. If the list was created in a Team Site, the List Definition associated with the list template will be 1033\STS\[ListTemplateName] (e.g. 1033\STS\custlist.) However, this may not be desired (as it was for me) – as the List Definitions under Team Site are different than the SPS Site Definitions (which include the Portal Header, etc.)

Moreover, if you’ve created custom Site/Area Definitions for the Portal (which we have,) the list template will reflect the incorrect definition. Consider the following screenshots from 1033\STS\custlist and the same List Definition under a custom Area Definition.


Custom List in STS

Custom List in Custom Area Definition

Thus, to ensure that the appropriate List Definition is used for WSS-generated list template when used in SPS, following the instructions below.

Save the WSS List as a Template

Under the General Settings heading of the Customize [ListName] page, select “Save list as template”, and specify the File Name, Title and whether or not the content of the list should be included in the template.

After clicking “OK”, navigate to the List Template Gallery.

From the List Template Gallery, save the template (.stp file) to your desktop by right-clicking the link and selecting “Save Target As...”.

Change the Manifest.xml file in the List Template (.stp file)

The SharePoint List Template file format (.stp) is actually just a Cabinet (.cab) file with its extension renamed. Inside of this file exists the list template manifest (metadata and list item content) – as well as additional content and files for document libraries. The manifest is simply an XML file that describes the list (which includes the metadata related to the Site and List Definitions with which the list was created.)

Thus, in order for the list template to use the appropriate Site and List Definitions, we need to extract, modify and repack the manifest from file. To begin, rename the list template to have a .cab extension (e.g. OpenPositions.stp.cab.) Now, on Windows XP, you can simply double-click the Cabinet file to view and extract its contents.

Extract the manifest file (manifest.xml) and open in Visual Studio (or any other Unicode editor [use Wordpad – not Notepad if VS is not available].) You may be prompted to update the line breaks in the file – using the Windows Default (CR LF) is acceptable. Once this file has opened, the first task is to update the Site Definition specified for this template.

Since this list was created in a Team Site, the TemplateID is set as 1 (STS) and the Configuration is 0 (Team Site.) This information is mapped in the 1033\XML\WEBTEMP.xml file. In order to specify the appropriate Site Definition, update both the TemplateID and Configuration elements to the desired values from either the WEBTEMPSPS.xml file, or any custom Site Definitions you’ve created (e.g. <TemplateID>20</TemplateID><Configuration>0</Configuration> for the SPS Site Definition.)

The next step is to update the element under each element associated with the List Definition.

In this example, the original value would map to the Team Site definition for a Custom List – 1033\STS\Lists\custlist. This should be updated for each file listed to the appropriate Site Definition to which this list will be deployed. For example, this value would be 1033\SPS\Lists\custlist if the list template would be deployed to the SharePoint Portal Home Area.

Once all of the path values have been updated for all files under in the manifest, we’ll need to repack the updated manifest.xml file (an any additional files included in the original .stp file) back into a Cabinet file. This can be done using the Microsoft Cabinet Tool – CABARC.exe (available with Visual Studio and Microsoft Windows SDK.) In this example, the only file to repackage is the manifest – cabarc N OpenPositions.stp.

Deploy the Updated List Template to Portal

Now that you have an updated list template, we have to deploy the template to SharePoint Portal Server. This can be done by accessing the Top-Level Site Administration page via the following URL:

http://[YourPortalServer]/_layouts/1033/webadmin.aspx

This page is different the Site Settings page, and exposes some core WSS functionality leveraged by SPS. Under the Site Collection Galleries heading, select ”Manage list template gallery”.

From the List Template Gallery page, select “Upload Template” and specify the .stp file created in the previous step:

ListTemplate
ID Description
100 Custom List
101 Document Library
102 Survey
103 Links List
104 Announcements List
105 Contacts List
106 Events List
107 Tasks List
108 Discussion Board
109 Picture Library
115 Form Library
120 Custom List in Datasheet View
1100 Issues List
ListBaseTemplate
ID Description
0 Links, Announcements, Contacts, Events, Tasks, Custom List, Custom List In Datasheet View
1 Document Library, Form Library, Picture Library
3 Discussion Board
4 Survey
5 Issues

Using this pattern, specify the appropriate values to access the New List page. Using this page, specify the Name, Description and Quick Launch options for the new list.

After clicking the Create button, you’ll be redirected to the new All Items view of the new list – using the appropriate definition :)

Thanks to the following posts, which were used as reference for this post (all of which offer great solutions - however, I wanted to provide a holistic solutions to such a problem):

  • http://weblogs.asp.net/mnissen/archive/2004/10/01/236593.aspx
  • http://msd2d.com/content/Tip_viewitem_03.aspx?id=b8c591e0-a755-48d7-830d-ae8761c10676
Posted on Friday, April 21, 2006 4:15 PM SharePoint | Back to top


Comments on this post: SharePoint Customization: Using WSS List Templates in SPS Areas

# re: SharePoint Customization: Using WSS List Templates in SPS Areas
Requesting Gravatar...
Great post! Must try this out on my MacawDiscussionBoard, I get this question so often!
Left by Serge van den Oever [Macaw] on Apr 22, 2006 2:55 PM

# re: SharePoint Customization: Using WSS List Templates in SPS Areas
Requesting Gravatar...
Guy,

It's my pleasure! If it weren't for blogs, I'd have no point of reference ;)

Best,

Scott
Left by skillet on Sep 05, 2006 4:33 PM

# re: SharePoint Customization: Using WSS List Templates in SPS Areas
Requesting Gravatar...
Good article, if this works it would solve a lot of problems. There could quite possibly be some further issues of interest. Is it possible to change the manifest.xml file to reflect a different language setting (I see the language tag)? Can one edit exported List dwp files in a similar way? (created using SPExport) It would be good to have some nice way to copy a list template from one language version of WSS/MOSS to another. I hope this article is valid for WSS 3.0, not just 2.0.
Left by Thomas Prentis on Sep 06, 2007 9:00 AM

# re: SharePoint Customization: Using WSS List Templates in SPS Areas
Requesting Gravatar...
Thanks for sharing this. It's very significant to find this information as this is very useful now. - Edmond Dentist
Left by Richard Jones on Dec 11, 2015 7:49 AM

Your comment:
 (will show your gravatar)


Copyright © svanvliet | Powered by: GeeksWithBlogs.net