除 Id 和 Tile 外的字段为 NULL
Fields except Id and Tile are NULL
我遇到了一个问题,除了 ID、Title、Created 等之外的所有字段都是 Null,因此所有自定义列都不会加载任何值。
我尝试使用 Include 加载 ListItems,但结果还是一样。
我做错了什么?
var participants = Spo.GetParticipants(true);
var oList = Ctx.Web.Lists.GetByTitle("Participant");
var camlQuery = new CamlQuery
{
ViewXml = "<ViewScope='RecursiveAll'><RowLimit>5000</RowLimit></View>"
};
var listItems = oList.GetItems(camlQuery);
//Ctx.Load(listItems,
// items => items.Include(
// item => item["ID"],
// item => item["Title"],
// item => item["Email"],
// item => item["FirstName"],
// item => item["Company"],
// item => item["Phone"],
// item => item["Street"],
// item => item["ZipCode"],
// item => item["City"]), items => items.ListItemCollectionPosition);
Ctx.Load(oList);
Ctx.Load(listItems);
Ctx.ExecuteQuery();
foreach (var oListItem in listItems)
{
foreach (var it in participants)
{
if (oListItem != null && oListItem["Email"].ToString() == it.Email)
{
oListItem["FirstName"] = it.FirstName;
oListItem["LastName"] = it.LastName;
oListItem["Company"] = it.Company;
oListItem["Phone"] = it.Phone;
oListItem["Street"] = it.Street;
oListItem["ZipCode"] = it.ZipCode;
oListItem["City"] = GetLookupCity(it.City);
//FieldLookupValue lv = new FieldLookupValue();
//lv.LookupId = int.Parse() it.City
p = "UPDATED: " + it.Email;
}
else
{
}
}
}
camlquery应该有问题。 View和Scope之间应该有空白
<View Scope='RecursiveAll'><RowLimit>5000</RowLimit></View>
我遇到了一个问题,除了 ID、Title、Created 等之外的所有字段都是 Null,因此所有自定义列都不会加载任何值。
我尝试使用 Include 加载 ListItems,但结果还是一样。
我做错了什么?
var participants = Spo.GetParticipants(true);
var oList = Ctx.Web.Lists.GetByTitle("Participant");
var camlQuery = new CamlQuery
{
ViewXml = "<ViewScope='RecursiveAll'><RowLimit>5000</RowLimit></View>"
};
var listItems = oList.GetItems(camlQuery);
//Ctx.Load(listItems,
// items => items.Include(
// item => item["ID"],
// item => item["Title"],
// item => item["Email"],
// item => item["FirstName"],
// item => item["Company"],
// item => item["Phone"],
// item => item["Street"],
// item => item["ZipCode"],
// item => item["City"]), items => items.ListItemCollectionPosition);
Ctx.Load(oList);
Ctx.Load(listItems);
Ctx.ExecuteQuery();
foreach (var oListItem in listItems)
{
foreach (var it in participants)
{
if (oListItem != null && oListItem["Email"].ToString() == it.Email)
{
oListItem["FirstName"] = it.FirstName;
oListItem["LastName"] = it.LastName;
oListItem["Company"] = it.Company;
oListItem["Phone"] = it.Phone;
oListItem["Street"] = it.Street;
oListItem["ZipCode"] = it.ZipCode;
oListItem["City"] = GetLookupCity(it.City);
//FieldLookupValue lv = new FieldLookupValue();
//lv.LookupId = int.Parse() it.City
p = "UPDATED: " + it.Email;
}
else
{
}
}
}
camlquery应该有问题。 View和Scope之间应该有空白
<View Scope='RecursiveAll'><RowLimit>5000</RowLimit></View>