我在 sharepoint 中有一个列表。我可以检索此列表,但无法从此列表中检索项目:
我的代码看起来很精简:
using (var ctx = new ClientContext("http://sp2.intranet.mmmm.net/LWW/Europe/Warsaw/loc/eng/"))
{
Web web = ctx.Web;
var tasksList = web.Lists.GetByTitle("IC-Portal-Announcements");
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View><RowLimit>100</RowLimit></View>";
ListItemCollection collListItem = tasksList.GetItems(camlQuery);
ctx.Load(collListItem, items => items.Include(
item => item.Id,
item => item.DisplayName,
item => item.HasUniqueRoleAssignments
));
ctx.ExecuteQuery();
foreach (ListItem oListItem in collListItem)
{
}
在oListItem中,我仍然在displayName中看到“IC-Portal-Announcements”,但我不知道如何获取图片上看到的两个任务。
对于初学者,您可以尝试以下查询:
var q1 = CamlQuery.CreateAllItemsQuery();
var viewfields = new string[] {"Id", "DisplayName", "HasUniqueRoleAssignments"};
var q2 = CamlQuery.CreateAllItemsQuery(1000, viewfields);
对于第二个,您可能可以在加载时省略包含语句 我不确定视场的名称是否正确。您可以使用 u2u caml 查询生成器检查
有关 caml 搜索的更多具体信息,请尝试此博客