2013-12-19 53 views
0

在下面的查詢中缺少什麼?它從文檔庫中獲取所有記錄?Caml查詢按照文件類型過濾

//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); 

感謝

回答

2

你應該有一個Query節點View節點的內部,WhereQuery內:

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

它的工作。謝謝 –