1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
System.Xml.XmlElement query = xmlDoc.CreateElement("Query");
System.Xml.XmlElement viewFields = xmlDoc.CreateElement("ViewFields");
System.Xml.XmlElement queryOptions = xmlDoc.CreateElement("QueryOptions");
query.InnerXml = "";// +
query.InnerText = "<Where><Lt><FieldRef Name=\"FileLeafRef\" /><Value Type=\"Counter\">3</Value></Lt></Where>";
viewFields.InnerXml = "<FieldRef Name=\"FileLeafRef\" />";
queryOptions.InnerText = "<IncludeMandatoryColumns>FALSE </IncludeMandatoryColumns> <DateInUtc>TRUE</DateInUtc>";
// items
XmlNode nodeListItems = listService.GetListItems(listName, null, query, viewFields, null, queryOptions);
XmlNode allLists = listService.GetListCollection();
// load into an XML document so we can use XPath to query content
XmlDocument allListsDoc = new XmlDocument();
allListsDoc.LoadXml(allLists.OuterXml);
XmlNamespaceManager ns = new XmlNamespaceManager(allListsDoc.NameTable);
ns.AddNamespace("d", allLists.NamespaceURI);
XmlDocument xmlResultsDoc = new XmlDocument();
xmlResultsDoc.LoadXml(nodeListItems.OuterXml);
ns = new XmlNamespaceManager(xmlResultsDoc.NameTable);
ns.AddNamespace("z", "#RowsetSchema");
XmlNodeList rows = nodeListItems.SelectNodes("//z:row", ns);
if (rows.Count == 0)
{//no doc
}
foreach (XmlNode row in rows)
{
textBox3.Text += row.Attributes["ows_FileLeafRef"].Value + "\t";
textBox3.Text += row.Attributes["ows_Modified"].Value + "\t";
textBox3.Text += row.Attributes["ows_Editor"].Value + "\t\t";
textBox3.Text += row.Attributes["ows_FileRef"].Value;
textBox3.Text += "\r\n";
} |
Partager