我正在使用客户端对象模型来更新 SharePoint 上的列表。
列表很简单,只有 3 列([Title]、[Author]、[Year Published])
【标题】为默认添加的标准栏,
[作者] 是我自己的列,它是一个字符串字段(它不指向用户,它只是纯文本)
和 [发布年份] 发布是一个数字。
所有字段都标记为必填项。
string strUrl = "http://server/sites/training";
using (SPSite oSite = new SPSite(strUrl))
{
using (SPWeb oWeb = oSite.OpenWeb())
{
SPList list = oWeb.Lists["Books"];
SPListItem book = list.AddItem();
book["Title"] = "SQL Server Internals";
book["Author"] = "Mc Fredy";
book["Year Published"] = 2015;
book.Update();
}
}
我得到例外book.Update();
无效数据已用于更新列表项。您尝试更新的字段可能是只读的。
我查看了我在网上找到的所有内容,但没有找到任何答案。请指教。