sbQuery.Append("");
sbQuery.Append("<where> ");
sbQuery.Append(" <and>");
sbQuery.Append("<eq> ");
sbQuery.Append("<fieldref name="\">");
sbQuery.Append("<value type="\">1</value>");
sbQuery.Append("</eq>");
sbQuery.Append("<contains>");
sbQuery.Append("<fieldref name="\">");
sbQuery.Append(string.Format("<value type="\">{0}</value>", folderName));
sbQuery.Append("</contains>");
sbQuery.Append(" </and>");
sbQuery.Append("</where>>");
sbQuery.Append("</query>");
sbQuery.Append("<viewfields>");
sbQuery.Append("<fieldref name="\"><fieldref name="\"><fieldref name="\">");
sbQuery.Append("</viewfields>");
sbQuery.Append("<queryoptions>");
sbQuery.Append("<viewattributes scope="\">");
sbQuery.Append("</queryoptions>");
sbQuery.Append("</mylistitemrequest>");
//the key here is the Scope= RecursiveAll will return all folders including subfolders.
//string query = "
XmlDocument doc = new XmlDocument();
doc.LoadXml(sbQuery.ToString());
XmlNode queryNode = doc.SelectSingleNode("//Query");
XmlNode viewNode = doc.SelectSingleNode("//ViewFields");
XmlNode optionNode = doc.SelectSingleNode("//QueryOptions");
XmlNode retNode = _lists.GetListItems(listname, string.Empty, queryNode, viewNode, string.Empty, optionNode, string.Empty);
return GetItemId(retNode);
No comments:
Post a Comment