Reverse Engineer the Schema of any List in SharePoint

By Namwar Rizvi - Last updated: Saturday, December 26, 2009 - Save & Share - 3 Comments

If you have ever designed a custom list then you may already felt the pain of creating the schema of it and writing the whole CAML. Sometimes, we just need to enhance an already existing list by creating our own custom list for which we want to copy the existing schema and do the necessary changes.

You can retrieve the schema of any list by using the owssvr.dll call from your browser. Following is the syntax

http://<YourServer>/_vti_bin/owssvr.dll?Cmd=ExportList&amp;List=<YourListGuid>”

By replacing the Server and List GUID in above url will return you the XML Schema of the list.

To make thing easier, I have created a Feature to add a custom action in Settings menu called “Display Schema“, Click it and you will get the schema of the list.

Steps to create the feature:

1. Create a new folder called “DisplaySchema” in Features folder.

2. Create Feature.xml file and paste the following code

<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="{A66E6CBA-8EA1-4c28-B233-52B3D7FF352B}"
    Title="Display List Schema"
    Description="This feature adds a custom menu item in Settings menu to display List Schema"
    Version="1.0.0.0"
    Scope="Site"
    xmlns="http://schemas.microsoft.com/sharepoint/">
  <ElementManifests>
    <ElementManifest Location="Elements.xml" />
  </ElementManifests>
</Feature>

3. Create Elements.xml file and paste the following code

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- List Toolbar Settings Menu Dropdown -->
  <CustomAction Id="DisplayListSchema"
    RegistrationType="List"
    GroupId="SettingsMenu"
    Location="Microsoft.SharePoint.StandardMenu"
    Sequence="1000"
    Title="Display Schema"
	Description="Displays schema of the list">
    <UrlAction Url="~site/_vti_bin/owssvr.dll?Cmd=ExportList&amp;List={ListId}"/>
  </CustomAction>
</Elements>

4. Install the feature by using stsadm command line tool.
5. Activate it.
6. Navigate to any list, Document Library, Tasks list etc. and click Settings, and then click Display Schema.
You will get the schema of that list. Copy it and enjoy!

Share
Posted in Customization, Feature, Solutions, Tips, Tools • Tags: , , , Top Of Page

3 Responses to “Reverse Engineer the Schema of any List in SharePoint”

Comment from Sanjay
Time February 24, 2010 at 6:17 am

This is extremely useful. Thanks for sharing.

Comment from BraniX
Time April 9, 2010 at 2:12 pm

Hello

Useful fining 🙂

But why there is statement that there is some RE involved, as far as I’m aware RE is process of gaining insight knowledge looking at transformed version of code(src code -> compiled code; if you analyze x86 asm, IL, Java bytecode etc and know what this code is doing, and what programmer coded this is RE) or sth what is hidden (obfuscated code or VM layer of some protector -> Execryptor …). In Your example we have plain XML nothing more, so you have original ‘form of information’.

No RE process involved 🙂

Regards

Comment from Denny
Time January 26, 2011 at 9:58 am

Good stuff. However, can you show how to do this in SharePoint 2010. While deploying, I got an error mentioning RegistrationId is required. I did provide the RegistrationId as 100 for Generic List. However, on deployment I cannot see the menu item under Site Actions.

Write a comment