我正在使用Moles为我的SharePoint应用程序编写单元测试用例,我被以下几行代码卡住了,我无法将SPField类型转换为SPFieldUser。
SField subfield = list.Fields.GetField("Subscriber");
SPFieldUser userfield = (SPFieldUser)subfield;
userfield.SelectionGroup = web.Groups["Focal Points"].ID; //error line shown in pex
I'm getting "NullReference" exception at the above line
Can someone guide me here..发布于 2012-02-03 04:41:10
虽然我相信你已经检查过这些……
<代码>G29
SPFieldUser userfield = subfield as SPFieldUser;所以,这些都失败了。让我们检查一下SPFieldUser对SField的协方差。继承层次结构是:
不幸的是,我没有Microsoft.SharePoint库来查看SPFieldLookup类是否在SPField中隐藏了一些重要的东西。
https://stackoverflow.com/questions/9099509
复制相似问题