Caml查询按FileType过滤

时间:2013-12-19 21:27:45

标签: c# sharepoint-2010

以下查询中缺少什么?它从文档库中获取所有记录?

//Specify the Caml Query
            CamlQuery camlQuery = new CamlQuery();
            camlQuery.ViewXml = "<View Scope='Recursive'><Where><Contains><FieldRef Name='File_x0020_Type' /><Value Type='text'>msg</Value></Contains></Where></View>";

            ListItemCollection listItems = sharedDocumentsList.GetItems(camlQuery);

由于

1 个答案:

答案 0 :(得分:2)

Query节点内应该有一个View节点,Where内部应该有Query个节点:

camlQuery.ViewXml =
@"<View Scope='Recursive'>
  <Query>
    <Where>
      <Contains>
        <FieldRef Name='File_x0020_Type'/>
        <Value Type='text'>msg</Value>
      </Contains>
    </Where>
  </Query>
</View>";