Querying on a list for particular folder:
we can use various properties for "Scope=''".
1. Default
2. Recursive
3. RecursiveAll
private DataTable GetDataTable(SPList list)
{
DataTable dt = new DataTable();
SPQuery qry = new SPQuery();
try
{
string relativeURL = list.RootFolder.Url;
qry.Query = "<Where><Eq><FieldRef Name='FileDirRef'/><Value Type='Lookup'>" + relativeURL + "/my folder/my next folder</Value></Eq></Where>";
qry.ViewAttributes = "Scope='RecursiveAll'";
SPListItemCollection coll = list.GetItems(qry);
dt = coll.GetDataTable();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
return dt;
}
we can use various properties for "Scope=''".
1. Default
2. Recursive
3. RecursiveAll
No comments:
Post a Comment