How does SharePoint store the CAML for the view filter?

I am trying to create a CAML request for a list in SP.

I thought about using Modify view pages to create a basic view including a filter, and then use some code to examine the SPView query request:

string t = dataList.Views["MyView"].Query;

      

But the CAML in t does not contain Where elements. Just orderby

<OrderBy>
    <FieldRef Name="ID" />
</OrderBy>

      

How does SharePoint store CAML filters for viewing?

+2


source to share


1 answer


Weird.

Because if you examine the built-in list schema (for example, the task list schema, which you can find in the C: \ Program Files \ Common Files \ Microsoft Shared \ Web Server Extensions \ 12 \ TEMPLATE \ FEATURES \ TasksList \ Tasks \ schema. xml) there is a Where clause in the Query element:



<View>
*....*
    <Query>
      <OrderBy>
        <FieldRef Name="Modified" Ascending="FALSE">
        </FieldRef>
      </OrderBy>
      <Where>
        <Or>
          <Neq>
            <FieldRef Name="Status">
            </FieldRef>
            <Value Type="Text">$Resources:core,Tasks_Completed</Value>
          </Neq>
          <IsNull>
            <FieldRef Name="Status">
            </FieldRef>
          </IsNull>
        </Or>
      </Where>
    </Query>
  </View>

      

Oh, you can try SPCamlViewer to examine your views.

+2


source







All Articles