0
我是新來的sharepoint,我試圖從sharepoint檢索的項目列表中建立父母及其各自子女的樹狀視圖列表。在我的代碼中,我使用「ID」字段值來標識項目,並使用「parentleafname」查找值來嘗試確定此項目是否具有父項。看起來,「parentleafname」中的「ID」和lookup值是相同的。我如何從返回的列表中的項目獲取父ID?Sharepoint 2013 GetItems父母身份證
private ListItemCollection GetList(string listName)
{
var web = _sharePointContext.Web;
Microsoft.SharePoint.Client.List list = web.Lists.GetByTitle(listName);
var query = new CamlQuery();
query.ViewXml = "<View Scope=\"RecursiveAll\"> " +
"<Query>" +
"<OrderBy>" +
"< FieldRef Name = 'ID' />" +
"</ OrderBy >" +
"</ Query >" +
"</View>";
query.FolderServerRelativeUrl = "/lists/" + listName;
ListItemCollection folders = list.GetItems(query);
_sharePointContext.Load(list);
_sharePointContext.Load(list.Fields);
_sharePointContext.Load(folders, fs => fs.Include(
fi => fi["Title"],
fi => fi["DisplayName"],
fi => fi["FileLeafRef"],
fi => fi["ParentLeafName"],
fi => fi["ID"],
fi => fi["ContentTypeId"]
));
_sharePointContext.ExecuteQuery();
return folders;
}