查找字段和无效数据已用于更新列表项错误

时间:2013-09-18 16:56:10

标签: sharepoint-2010

我的列表A包含三列JobNumber,Crew和Date,这是列表B的查阅列。当我在列表B中创建三个单独的查找字段时,下面的代码工作正常,

SP.FieldLookupValue lvjobNum = new SP.FieldLookupValue();
lvjobNum.LookupId = ID;
lItem["JobNumber"] = lvjobNum;

SP.FieldLookupValue lvCrew = new SP.FieldLookupValue();
lvCrew.LookupId = ID;
lItem["Crew"] = lvCrew;

SP.FieldLookupValue lvDate = new SP.FieldLookupValue();
lvDate.LookupId = ID;
lItem["Date"] = lvDate;

但是,当我使用“附加列设置”选项创建查找字段时,

enter image description here

然后上面显示的相同代码不起作用,它会抛出错误,

<nativehr>0x80070057</nativehr><nativestack></nativestack>Invalid data has been used to update the list item. The field you are trying to update may be read only.

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

(OP作为问题的编辑回答。在此转录为社区维基答案。请参阅Question with no answers, but issue solved in the comments (or extended in chat)

OP写道:

  

修复很简单,

SP.FieldLookupValue flvRDS = new SP.FieldLookupValue();
flvRDS.LookupId = ID;
lItem["RDS"] = flvRDS;