Read the required list item directly using CAML query. You can search for a list item inside folders by setting Scope attribute to Recursive as follows:
SPWeb web = SPContext.Current.Web;
SPWeb web = SPContext.Current.Web;
SPList list = web.Lists["Shared Documents"];
string content = string.Empty;
SPQuery query = new SPQuery();
query.ViewAttributes = "Scope=\"Recursive\"";
query.Query = "<Where><Eq><FieldRef Name='FileLeafRef' />
<Value Type='File'>NewProcess.js</Value></Eq></Where>";
SPListItemCollection items = list.GetItems(query);
SPListItem item = items[0];
No comments:
Post a Comment