我正在使用SharePoint 2013客户端对象模型。
我收到的Microsoft.SharePoint.Client.ServerException说:"值不在预期的范围内"运行_context.ExecuteQuery()时。只要我注释掉语句entry["Author"] = authorValue;
:
entry["Body"] = post.Body;
entry["Created"] = post.Created;
entry["Modified"] = post.Modified;
FieldUserValue authorValue = new FieldUserValue();
User author = _context.Web.EnsureUser("Mr. X");
_context.Load(author);
_context.ExecuteQuery();
authorValue.LookupId = author.Id;
entry["Author"] = authorValue;
entry.Update();
_context.ExecuteQuery();
"作者"是一个有效的字段名称。我还读到了关于增加" List View Lookup Threshold" http://dotnetfollower.com/wordpress/2012/05/sharepoint-value-does-not-fall-within-the-expected-range-exception-in-spfieldmap-getcolumnnumber/中的值为20。但是这个值已经设定为5000。
我还通过添加以下两个语句来检查entry["Author"]
的值,而没有明确地设置它(entry["Author"] = authorValue
已注释掉):
_context.Load(entry);
_context.ExecuteQuery();
类型为Microsoft.SharePoint.Client.FieldUserValue
,其LookupId
属性值等于authorValue.LookupId
。
我错过了什么?