Exporting List Definitions in a development environment using Visual Studio 2008

, ,

Visual Studio 2005 extensions for Windows SharePoint Services 3.0 (VSeWSS) ship with a useful tool called SharePoint Solutions Generator. One of its features I use most often is creating a List Definition based on an existing list. Since the CAML schema of a list isn't really straight-forward – especially if the list uses complex settings and multiple custom views it's almost undoable to create such schema manually. Another possibility could be using List Templates instead of List Definitions. List Templates are unfortunately impossible/difficult to customize and should be used, in my opinion, in SharePoint configuration scenarios when there is no other choice. SharePoint Solution Generator comes very useful if you want to work with List Definitions but you don't want to type all the CAML yourself.

VSeWSS has however one major flaw: it doesn't work on development environments using Visual Studio 2008.


First of all the extensions will not even install as the setup checks the Visual Studio 2005 dependency. Even bypassing the setup and copying the installed version of SharePoint Solution Generator to a development environment using VS 2008 doesn't work: SharePoint Solution Generator throws an exception during the start. The fact that there is no tool for exporting an existing list to a List Definition has suddenly become a serious risk in the project I'm currently working on. Installing VS 2005 next to VS 2008 might be a solution. I haven't tried it personally because it simply didn't seem right to me: installing a huge IDE in order to be able to run a tiny (yet very useful) utility.

While exploring the possible solutions I have found out that SharePoint Solution Generator exports lists to List Definitions using the /_vti_bin/owssrv.dll. The call is very simple: http://yoursite/_vti_bin/owssrv.dll?cmd=ExportList&List=<List GUID>. This call returns the contents of the Schema.xml file of a List Definition. The list forms (AllItems.aspx, NewForm.aspx, etc.) can be retrieved using the Files property of a list. Further research has proven unfortunately that the exported Schema.xml doesn't work: creating a list based on this schema results in an exception. Looking deeper into SharePoint Solution Generator I have noticed that the tool alters the exported Schema.xml after it has been exported. It's quite odd that the WSS team has created a functionality for exporting the Schema.xml which cannot be exported unless altered!

Eventually I have succeeded in wrapping it all together into a working package. I have created a custom StsAdm command called ocdexportlist (ocd stands for One Click Deployment – the development strategy we have designed and developed together with some custom tools. More about OCD coming soon). I will try to publish the command before I go to the Microsoft Office System Developer Conference 2008. Stay in touch for updates.

Possibly related posts

4 Responses to “Exporting List Definitions in a development environment using Visual Studio 2008”

  1. Waldek Mastykarz » Blog Archive » Export List Definition - free StsAdm command Says:

    [...] one of my previous blogs I have mentioned that there is a serious problem if you want to develop SharePoint 2007 solutions [...]

  2. Shane Tarter Says:

    This is an interesting article – I chose to use VS 2008 solely for my SharePoint development a few months back and I haven't had the need to use the SharePoint Solution Generator until now. I discovered, much to my dismay that the SSG is part of the WSS extensions, which are not compatible with VS 2008. I searched and discovered that version 1.1 of the WSS extensions is available. Desperately needing the assistance of SSG, I decided to attempt the installation of the extensions, realizing that I wouldn't get the application template support, but hoping SSG would still run. It made it through the installation just fine, and SSG runs successfully. As I mentioned, I don't have the SharePoint application template support, but SSG seems to generate list definitions as normal. I am sure this is not supported, so proceed at your own risk. For now, my environment seems to running just fine.

  3. Waldek Mastykarz Says:

    Thank you for your comment and sharing your experience Shane. I have read somewhere on the Internet that there will be a version of VSeWSS supporting VS2008 coming out in May or June this year. Until that time we all will have to work with the tools we have available now.

  4. Parshuram Says:

    Thats a good insight into the dark secrets of reverse engineering of Sharepoint objects (esp. Lists), i am still trying to figure out how to code this Schema.xml generation of an existing custom list definition.

    I am working on a MOSS Studio that would let a user to do deployment, reverse engineer, activate features, backup, restore and all.

    Looking forward to your next article.

    Regards
    Parshuram

Leave a Reply

Security Code:

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS
Copyright © 2007 - 2010 Waldek Mastykarz

Creative Commons License