2011-07-27 50 views
5

我想使用CrossListQueryCache選擇文檔庫的文件夾列表(無子文件夾,不遞歸)。僅用於選擇頂層文件夾的CAML查詢

一切工作正常,除了我收到列表中的所有文件夾和子文件夾,而不僅僅是第一級文件夾。 我需要什麼,在下面的代碼來改變,這樣沒有他們的子文件夾和子子文件夾等僅返回文件夾的第一級...

string query = string.Empty; 
string websQuery = string.Format("<Webs Scope=\"{0}\"/>", "None"); 
string lists = "<Lists ServerTemplate=\"101\"" + " ><List ID=\"" + listid + "\" /></Lists>"; 
bool useList = true; 
string relativeUrl = this.GetRelativeUrl(); 
query = string.Format("<Where><Eq><FieldRef Name='FSObjType' /><Value Type='LookUp'>1</Value></Eq></Where>", relativeUrl); 

CrossListQueryInfo info = new CrossListQueryInfo(); 
info.Lists = lists; 
info.Webs = websQuery; 
info.Query = query; 
info.ViewFields = "<FieldRef Name=\"FileLeafRef\"/>"; 
info.WebUrl = web.ServerRelativeUrl; 
CrossListQueryCache cache = new CrossListQueryCache(info); 
SiteDataResults sd = cache.GetSiteDataResults(site, true); 

回答