0
mlNode listNode = listSvc.GetList("{...}");
XmlDocument xmlDoc = new XmlDocument();
XmlElement query = xmlDoc.CreateElement("Query");
query.InnerXml = "";
XmlElement queryOptions = xmlDoc.CreateElement("QueryOptions");
queryOptions.InnerXml = "";
XmlElement viewFields = xmlDoc.CreateElement("ViewFields");
viewFields.InnerXml = "<FieldRef Name='MiddleName' />";
XmlNode ndListItems = listSvc.GetListItems("{...}", string.Empty, query, viewFields, string.Empty, null, null);
xmlDoc.LoadXml(ndListItems.OuterXml);
XmlNodeReader xmlReader = new XmlNodeReader(xmlDoc);
DataTable dtable = new DataTable();
DataColumn MiddleName = dtable.Columns.Add("MiddleName", typeof(String));
foreach (DataRow row in dtable.Rows)
{
  foreach (XmlNode listItem in ndListItems)
  {
     row["MiddleName"] = listItem.OuterXml;
  }
}
dataSet.Tables.Add(dtable);

When i debug it, I see what dtable is empty. But ndlistItem contain some data like it:

<listitems xmlns:s="uuid:..." xmlns:dt="uuid:..." xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<rs:data ItemCount="1">
   <z:row ows_MiddleName="..." ows_MetaInfo="..." ows__ModerationStatus="0" ows__Level="1" ows_ID="..." ows_UniqueId="...;#{...}" ows_owshiddenversion="2" ows_FSObjType="...;#0" ows_Created="..." ows_PermMask="..." ows_Modified="..." ows_PersonalDataProtection="1" ows_FileRef="...;#Lists/UserProfile/..._.000" />
</rs:data>
</listitems>

How take ows_MiddleName in row["MiddleName"]?

1 Answer 1

0
for(int i = 0; i < n.ChildNodes[1].ChildNodes.Count;i++)

{

if(n.ChildNodes[1].ChildNodes[i].Attributes!=null)

Console.WriteLine("Event " + n.ChildNodes[1].ChildNodes[i].Attributes["ows_Title"].InnerText + " begins on " + n.ChildNodes[1].ChildNodes[i].Attributes["ows_EventDate"].InnerText);

}

source

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.