Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In SharePoint, what is the easiest way to create a custom list 'schema.xml' file?

Like many other SharePoint users, I've had to create a custom list definition. After much trouble, I've managed to create one (I think, let me get through all the errors first), but is there a "basic" schema out there I can start with, or a purpose built editor for Schema.xml generation?

like image 923
tekiegreg Avatar asked Jan 13 '09 23:01

tekiegreg


2 Answers

To create custom list definition I always use some built in list definition as template.
Create new feature then copy schema.xml (maybe some other files also if present) from existing feature and modify schema.xml file directly with some text editor. I don’t have tried any custom editor for that and always get work done with copy-paste and changing attributes values.

Built in list definitions are located in 12 hive as features:

  • Custom List – Features/CustomList/CustList/schema.xml;
  • Document Library – Features/DocumentLibrary/DocLib/schema.xml;
  • Calendar – Feature/EventsList/Events/schema.xml;
  • Use search to find others.
like image 78
EG. Avatar answered Sep 29 '22 12:09

EG.


My recommendation, and what will bring you the closest to a final version, is to use the SharePoint web interface, set up your list as you want it, including views, custom columns, etc. Then, save the list as a template.

The .stp file you get is basically just a .cab file with a funny name. Rename to cab and extract the manifest, which will include a nearly ready-to-use schema.xml file for you to use.

What you need to change is the path or setuppath of the list forms. You will find these at the bottom of the manifest.xml file. These forms, if you use the default SharePoint lists, can be set to SetupPath="pages/form.aspx". Here is an example from the custom list forms element:

    <Form Type="DisplayForm" Url="DispForm.aspx" 
SetupPath="pages\form.aspx" WebPartZoneID="Main" />
    <Form Type="EditForm" Url="EditForm.aspx" 
SetupPath="pages\form.aspx" WebPartZoneID="Main" />
    <Form Type="NewForm" Url="NewForm.aspx" 
SetupPath="pages\form.aspx" WebPartZoneID="Main" />

You also need to update the View path for every view, which should be SetupPath="pages/viewpage.aspx" if using the default forms in your original site.

Note that you need to modify other attributes as well, but if you make sure to follow the wss.xsd schema and that your custom list schema.xml validates to the wss.xsd schema you should be ok.

.b

like image 25
Bjørn Furuknap Avatar answered Sep 29 '22 11:09

Bjørn Furuknap