Thursday, 24 June 2010

Importing SharePoint 2007 list templates (STP) into SharePoint 2010

Damn, only my second post and I'm already covering *shiver* SharePoint.

Anyway, I've been working on migrating an existing WSS 3.0 customisation to a new SPF 2010 environment today. Most of the stuff was pretty straightforward (some webparts, webservices, a few event handlers, ...), but there was one thing that didn't work out as planned.

My predecessor relied on list templates stored in STP files to deploy the custom list templates and create some lists instances based on them.

(This deployment involved manual uploading & creating of lists, maybe I'll do a quick overview on how you can automate this in the coming days... pretty easy stuff tho).


Now, while STP site templates are no longer supported, STP list templates
should still work in SharePoint 2010. Unfortunately things were a bit trickier than I expected them to be.

As a test I started with uploading one of the original STP's to the template catalog (
_catalogs/lt). No problem so far, but when I tried to create a list based off that template I got the following error:
Error
Microsoft SharePoint Foundation version 3 templates are not supported in this version of the product
Correlation ID: {random guid}
Date and Time: ....

Dang, that didn't look to good. Googling around didn't help either, as they all suggested on installing the original solution in a 2007 environment, upgrading the environment to 2010 & then exporting the list again as a template.

As this wasn't an option, I decided to delve deeper into the STP file. As you might know, these STP files are just renamed CAB files. This means you can safely rename them again to .CAB and extract their contents ... which I did.

Doing so revealed that my STP/CAB file only contained a single file: manifest.xml. This file contains the definition of your list: its fields, contenttypes, views, ...
To have some data to compare to, I created a new, custom list in SPF2010 and exported it as an STP template. Once again I renamed the file to .CAB and viewed its contents ... and there was much rejoicing.

It turned out that the SPF2010 STP had the same content as the WSS 3.0 STP: just a single manifest.xml. A quick diff between the two
manifest.xml files revealed that they're both quite similar and that there's a ProductVersion element in both files.
In the WSS 3.0 version, this element has a value of 3 ... but in the SPF2010 version, it has a value of 4. Could it be solved this easily?

Guess it was. I changed the value of the
ProductVersion element in the original manifest.xml to 4 and repackaged it into a CAB. Renamed the CAB to STP and uploaded it again in SPF2010 and behold ... no more errors when creating lists from that template!

Summary
So if you need to migrate list templates STP's from SharePoint 2007 to 2010, you could try the following:

  1. Rename the original .STP to .CAB
  2. Extract its manifest.xml to a local folder (lets call it {workingfolder})
  3. Search for the ProductVersion element. This should have a value of 3
  4. Change its value to 4
  5. Repackage the manifest.xml into a .CAB. I've done this by using makecab.exe in the C:\Windows\System32 folder
    Syntax
    : makecab.exe {workingfolder}\manifest.xml {workingfolder}\{template-name}.cab
  6. Change the generated cabinet's extension from .CAB back to .STP and upload it into the _catalogs/lt
Update
For those looking to migrate a 2007 doc lib with content: apparently a fellow SharePoint-victim has written a powershell script for this - http://www.heyweb.net/2011/06/converting-sharepoint-2007-document-library-templates-for-sharepoint-2010/
Kudos to Peter! :)

63 comments:

  1. You rock man! It Worked!

    - Christopher Rathermel

    ReplyDelete
  2. 'T was my pleasure to help ... :)

    ReplyDelete
  3. Hi,

    How can we convert .cab file back to .stp?

    Thanks

    ReplyDelete
  4. When I followed these directions and then attempt to create a new list using this template, I do not see this template in my available list. Am I missing a step?

    dslay

    ReplyDelete
  5. Lo Doug,
    Hard to tell if you missed a step :)

    You did upload it to the list templates catalog, right? (located in /_catalogs/lt)
    Also make sure your template has the same language as the one you used to create the site collection. For instance, afaik you can't use 'English' list templates in 'French' site collections.

    ReplyDelete
  6. got the same problem as Doug ... Can't use the stp i uploaded... I had a language problem and i changed the language of the stp with STP Language Converter and uploaded the files again ( product version is 4 after conversion) ... but that didn't work. I used stsadm to add the template, it says "success" but no new list in the creation page . Any help ?

    ReplyDelete
  7. one more thing worth mentioning: if you migrate a Sharepoint 2007 site, than the list templates are changed to productversion 4 - and they work. However the list template catalog still shows productversion 3 for them. Looks like this is not updated by the migration process.

    ReplyDelete
  8. Thanks for the insight; helped me to focus on VS 2008 to VS 2010 SP webpart migration instead of being stopped by the source list data. Does anyone one know if MS is going to support pulling lists from SP 2007?

    ReplyDelete
  9. YOU ARE THE BEST !!!!!! It is working !!!!
    Thanks

    ReplyDelete
  10. Hey, thanks for all. Only one question: where is the /_catalogs folder located?????

    ReplyDelete
  11. Maybe it was a bit too cryptic, but "/_catalogs/lt" actually refers to the list templates gallery's url.

    The long version would've been:
    Go to Site Actions > Site Settings > Modify All Site Settings and then click on List Templates in the Galleries section. (This will actually redirect you to http://yourmossserver/_catalogs/lt). Finally click on the Upload button to upload your template.

    ReplyDelete
  12. that worked....excellent finding.
    Thanks

    ReplyDelete
  13. Is there any way you can create .stp file for list using STSADM command?

    ReplyDelete
  14. Hi, I was able to see the template and when I use it I noticed the actual content is not there but the field structure is there. have you experience this one?

    ReplyDelete
  15. Dude Tom, you rock! This worked perfectly. I don't understand Microsoft sometimes... Why would they not write an upgrade script to do this automatically?

    ReplyDelete
  16. Hi,

    Nice post but when i did everything that you told... list was imported into system but when I tried to create a list from imported template, it says 'Cannot complete Action'. But when i have noticed that list has been created in the Lists section. But when i click on newly created list... it says.... HTTP 404 Not Found. So i guess list was not created completely. Any ideas why is it so? or how to fix it?

    ReplyDelete
  17. Hi,

    This worked pretty well for me. One glitch, though, is that I had an "Edit" icon as the first field in the (2007) template. When I click on the icon in 2010, it opens the edit form in a new page rather than the dialog window. If I try to edit from the drop-down on the title, it opens in the dialog. The new item form also opens in a dialog. Other lists I created in 2010 open a dialog from the edit icon. Any ideas on what happened and what I might do to fix it?

    ReplyDelete
  18. Yep, the above works - however....

    Whenever I try to now create a new Item in the list i get :

    ERROR: Unable to find the defaults new form for list [List name]

    Any ideas?

    ReplyDelete
  19. This comment has been removed by the author.

    ReplyDelete
  20. thanks a lot for your heads up, excellent job...
    is the prepare for migration "pre-upgrade checker" wont do this job, converting the version to 4?

    ReplyDelete
  21. how to migrate the list template which has got lookup column referencing to the some other column inside the same list? When I try your method, list got migrated but lookup column data is missing

    ReplyDelete
  22. ok so this worked and uploaded but I cannot find it as a list when I go to create a new list. How do we activate these once they are done?

    ReplyDelete
    Replies
    1. If you don't find the ListTemplate in Add an App section you can always go to _layouts/15/create.aspx to find all the templates

      Delete
  23. Rod, normally they should be usable once they're uploaded in the gallery.
    Are you sure your template has the same language as the one you used to create the site collection? I know that can prevent an uploaded template from being listed at the list creation page.

    ReplyDelete
  24. Looks like it's been a while since I last checked the comments on this post.

    Regarding the remarks on how to migrate a list with content: this is currently not covered by this workaround. When I find some spare time I might look for a solution (not promising a damn thing tho ;))

    ReplyDelete
  25. And for the remarks on missing columns: it's possible that you'll have to change the references to these columns in the template's xml. I'm not covering this, as it differs for each fieldtype ... but my suggestion is: try to recreate a dummy list with a lookup field in a 2010 environment and export that dummy list as a template.

    Then compare the 2010 template xml with the 2007 template's xml and check for differences in the lookup field's definition (that's how I figured out the issue with the version numbers).

    ReplyDelete
  26. Gold! thanks mate, was struggling to bring in a SP20078 calendar with 7000 events, but this worked in a matter of minutes! legend

    ReplyDelete
  27. This comment has been removed by the author.

    ReplyDelete
  28. Tom, great post!

    This seems revelant, but not sure if it actually matters, in the manifest.xml file, I also changed the MetaKey version to be the current Sharepoint version, as below:

    New Value: MetaKey Name="vti_parserversion" Value="SR|14.0.6029.1000"

    Old Value: MetaKey Name="vti_parserversion" Value="SR|12.0.0.6562"

    ReplyDelete
  29. Tom, quick question - Do you know how to migrate a MOSS 2007 Site template stp file to work on Sharepoint 2010??

    ReplyDelete
  30. Nope sorry, haven't tried to migrate those yet.

    ReplyDelete
  31. I have had a failure. I received the following messages in the logs. I did change the TemplateType value from 100 to 107 and that just listed the lists under Tracking. The lists uploaded fine, I get an error when trying to create new list from the templates.

    System.ArgumentException: Feature '75a0fea7-08d9-4a8f-b1cd-953d4f15467f' for list template '100' is not installed in this farm. The operation could not be completed...

    GetUserListSchema(): Failed to get the list schema XML for feature '{75A0FEA7-08D9-4A8F-B1CD-953D4F15467F}', template '100': hr=0x8107058A.

    ReplyDelete
  32. May god bless you.

    it saved a day

    ReplyDelete
  33. Hello, I followed all the steps and I have the same problem as Rod. After I uploaded the template to the library. When I create a new list, I don't see the template I uploaded. I checked the manifest.xml file it shows language is 1033. The language is always English.

    ReplyDelete
  34. I might have figured out the reason why the SP2010 site doesn't pick up the uploaded template. My template is not a standard template. It's instead a customized template. This doesn't work with customized template.

    ReplyDelete
  35. Excellent!! Works perfectly.

    ReplyDelete
  36. Thank you so much....worked great!

    ReplyDelete
  37. Bammmmm...you da man. So easy to follow.

    ReplyDelete
    Replies
    1. Brilliantly simple.
      And proof positive that MSFT's excuse for not converting OLSB sites to the O365 platform is completely bogus. They couldn't even be bothered to change one number. Sad.

      Delete
  38. I followed all the instruction posted here and converted the product version from 3 to 4 and did repackage the cab and uploaded it to the list template gallery. But i don't see the template that i uploaded in the create new list options.

    Can any one tell me why i'm not able to see the list template that i uploaded. I have the same language both in site collection and list template 1033.

    May be it worth mentioning, the template i am using is derived from the SharePoint 2007 document library , i hope that will not matter? Thanks!

    ReplyDelete
  39. Hello Tom..

    It works.. thanks a lot. Some one asked how to convert cab to stp.. it shows as .stp.cab when u rename. You have to go to control panel->folder options-> view and uncheck the "hide extensions for known file types".

    Thanks again Tom. You saved the effort of doing things again.

    ReplyDelete
  40. Hi Tom,
    It's a great work, but I have an issue!!
    When I created the a list using my "fixed list" from SP 2007 to SP 2010 I got the field "Created By" as "System account" since I was logged as system account.
    Do you know how can I keep the original authors "created by" and don't replace them automatically by the logged user?
    even though the field "created date" get the actual date when creating the list.
    I'll appreciate a lot any tip :-)

    Regards
    Ashraf

    ReplyDelete
    Replies
    1. Did you find out how to solve "keep the original outher" problem?

      Regards

      Maria

      Delete
    2. Hi Maria,
      Unfortunately,I could keep the original authors and I don't this there is anyway to do that, but I found a workaround solution as follow:
      When you do the import you get the field "Created By" and a new field automatically named "Created By1" which contains the current user,i.g. system account. In the "View List" you can hide the field "Created By1" and let the "Created By" to be visible.
      The problem with this solution is the content in the "Created By" is not clickable since the content type is "One line text" and not "Person/group" and you are not able to change it.
      Good luck

      Delete
  41. Hey You rock my world dude! Thank u for Your post, it save my day ^^

    ReplyDelete
  42. Awesome post! Having some issues though.

    When I try to save a Issue Tracking list as a template the "Inclued Content" box isnt available. Can anyone help me?????

    ReplyDelete
  43. Someone copied off your page without giving you credit:

    http://sprider.org/2011/08/23/microsoft-sharepoint-foundation-version-3-templates-are-not-supported-in-this-version-of-the-product-error/

    ReplyDelete
  44. Great Post, I love to read articles that are informative and actually have good content. Thank you for sharing your experiences and I look forward to reading more.
    website design

    ReplyDelete
  45. You are MY HERO! You just saved my A$$! Thanks a ton for sharing this tip! You just saved my day!

    ReplyDelete
  46. You just saved me a heap of time. Thanks so much for posting this guide :D

    ReplyDelete
  47. Is there a way to batch update list templates as outlined? We have a site that has over 150 list templates in the gallery, we don't know which ones are being used. Is there a way to preview it? Is there a way to find out which ones are being used?
    Thanks in advance.

    ReplyDelete
  48. Hi, I tried your way and it works very well for most of the calendars. However for calendars, when I extract them, I got some .000 files (ex. t6400000.000, g6400000.000, etc) besides the manifest.xml. And I tried to repackage it without these .000 files but it does not work... Any idea

    ReplyDelete
  49. This comment has been removed by the author.

    ReplyDelete
  50. Wonderful walk-through, sir. Worked like a charm and saved me hours of work. Thank you.

    ReplyDelete
  51. For much more enhanced results and optimized benefits, you can take help from experts making a call at 855-511-6911 QuickBooks Enterprise Support Phone Number Connecticut

    ReplyDelete
  52. This comment has been removed by the author.

    ReplyDelete

  53. Thankyou For infrormative informtion, keep it up and write more informative blog and if face any kind of issue regarding to Quickbooks Enterprise Support Phone Number Washington dont go anywhere just call at +1-855-533-6333.

    ReplyDelete
  54. Thankyou For infrormative informtion, keep it up and write more informative blog and if face any kind of issue regarding to QuickBooks Enterprise Support Phone Number New Mexico dont go anywhere just call at +1-855-533-6333.

    ReplyDelete