Thursday, August 27, 2009

Get CAML Query for list view

If we have a list and through ui we have created a view with some filter condition for that list.Sometime we need same records using CAML query in our code.But there is no way to get CAML from a list view through UI.In following ways you can get CAML for a list view.

  1. save the list as a template

  2. download the stp

  3. rename as a cab

  4. extract the manifest.xml.Following are the outxml for this

    <?xml version="1.0" encoding="UTF-8" ?>
    <ListTemplate WebUrl="http://dip-srv:6666">

  5. explore <UserLists>

    <List Name="{...}" Title="...>

  6. exlore ur view under <Views> tag and look for <Query> tag .this is ur CAML.

    <View Name="{...}" Type="HTML" DisplayName="..." ...>
    <GroupBy ...></GroupBy ...>

No comments: