SPFieldUserValue:值不在预期范围内

时间:2012-10-10 17:28:15

标签: sharepoint-2010

以下错误返回以下错误,不确定问题在哪里,

  

异常详细信息:System.ArgumentException:值不在预期范围内。

public static SPUser convertStringToSPUser(string struser)
{
    SPFieldUserValue userValue = new SPFieldUserValue(SPContext.Current.Web, struser);
    SPUser objSPUser = userValue.User;
    return objSPUser;
}

我的字符串就像是“S,Rishi”。

1 个答案:

答案 0 :(得分:4)

为了创建SPFieldUserValue的实例,您应该传递具有以下格式的字符串: [INT];#[域] \ [用户名]

从列表项中获取该值的最简单方法是: 列表项[field_GUID]的ToString();

相关问题