in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

Tech MOSS Team

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.

Comments

 

Links (2/5/2008) « Steve Pietrek’s SharePoint Stuff said:

Pingback from  Links (2/5/2008) &laquo; Steve Pietrek&#8217;s SharePoint Stuff

February 5, 2008 8:07 PM
 

Shane Tarter said:

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.

March 5, 2008 11:33 AM
 

Waldek Mastykarz said:

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.

Recently I have moved my blog (and this post as well) to blog.mastykarz.nl/.../exporting-list-definitions-in-a-development-environment-using-visual-studio-2008. I would really appreciate it if you have posted your comment there as well so that the visitors with updated URL can read is as well.

Thank you in advance,

Waldek

March 6, 2008 12:09 AM

Leave a Comment

(required )  
(optional )
(required )  
Add

About Waldek Mastykarz

Waldek Mastykarz is a Dutch SharePoint 2007 developer specialized in Web Content Management solutions in Microsoft Office SharePoint Server 2007, web standards and accessibility.

Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts