我正在提取 SharePoint 网站集用户的 XML 列表,然后尝试查询 InnerXml。InnerXml 看起来像这样:
<Users xmlns="http://schemas.microsoft.com/sharepoint/soap/directory/">
<User ID="91" Name="Jane Smith" LoginName="domain1\jsmith" />
<User ID="814" Name="Brad Jones" LoginName="domain1\bjones" />
<User ID="1252" Name="Charles Johnson" LoginName="domain2\cjohnson" />
</Users>
el
即使有 ID 为 814 的用户,查询也不返回任何内容(为 null)。
XmlNode siteUsers = tempug.GetUserCollectionFromSite();
XElement root = XElement.Parse(siteUsers.InnerXml);
IEnumerable<XElement> siteUsersElement =
from el in root.Elements("User")
where (string)el.Attribute("ID") == "814"
select el;
foreach (XElement el in siteUsersElement)
Console.WriteLine("el: " + el);
root
包含 InnerXml 文本,所以我认为问题与 SharePoint 无关。