Sharepoint Insight by Namwar Rizvi

Sharepoint Tips, Tricks and inside knowledge from real world experience by Namwar Rizvi

Reverse Engineer the Schema of any List in SharePoint

Posted by namwar on December 26, 2009


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>&#8221;

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!

Advertisements

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

  1. Sanjay said

    This is extremely useful. Thanks for sharing.

  2. BraniX said

    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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: