获取"价值不在预期范围内"在与CSOM创建新讨论时

时间:2014-07-25 12:17:00

标签: sharepoint sharepoint-2010 sharepoint-2013 csom

我正在使用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

我错过了什么?

0 个答案:

没有答案