在Sharepoint 2013, 我试图从自定义列表中获取用户信息以显示在编辑窗体中,该窗体将显示在控制ClientPeoplePicker中。Sharepoint 2013,从列表中获取数据ClientPeoplePicker
我搜索周围,并用2个解决方案的尝试:
private void LoadUserToPeoplePicker(SPListItem item, string colName, ClientPeoplePicker peoplePicker)
{
//Get user information from list
var user = item[colName] as string;
if (!string.IsNullOrEmpty(user))
{
var spUser = new SPFieldUserValue(SPContext.Current.Web, user);
//Solution 01
var entity = new PickerEntity();
entity.Key = spUser.LookupValue;
PeopleEditor editor = new PeopleEditor();
entity = editor.ValidateEntity(entity);
peoplePicker.AddEntities(new List<PickerEntity> { entity });
//Solution 02
//if (!string.IsNullOrEmpty(spUser.User.Email))
//{
// peoplePicker.InitialUserAccounts = spUser.User.Email;
//}
}
}
我叫他们Nintex形式的控制装置:保护覆盖无效OnFormControlDataBinding(对象发件人,EventArgs的)
这是错误我:
Type 'Microsoft.SharePoint.SPUser' in Assembly 'Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' is not marked as serializable.
描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关该错误的更多信息以及源代码的位置。
异常详细信息:System.Runtime.Serialization.SerializationException:在程序集'Microsoft.SharePoint,Version = 15.0.0.0,Culture = neutral,PublicKeyToken = 71e9bce111e9429c'中键入'Microsoft.SharePoint.SPUser'未标记为可序列化。
源错误:
在当前web请求的执行过程中生成未处理的异常。关于异常的来源和位置的信息可以使用下面的异常堆栈跟踪来标识。
堆栈跟踪:
[SerializationException:类型 'Microsoft.SharePoint.SPUser' 在大会 'Microsoft.SharePoint程序,版本= 15.0.0.0,文化=中性公钥= 71e9bce111e9429c' 未标记为可序列。] System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType型)14210117个 System.Runtime.Serialization.FormatterServices.GetSerializableMembers(类型类型,的StreamingContext上下文)408 System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo( )+420 System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj,ISurrogateSelector surrogate Selector,StreamingContext上下文,SerObjectInfoInit serObjectInfoInit,IFormatterConverter转换器,ObjectWriter objectWriter,SerializationBinder联编程序)+532 System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj,ISurrogateSelector surrogateSelector,StreamingContext上下文,SerObjectInfoInit serObjectInfoInit,IFormatterConverter转换器,ObjectWriter objectWriter,SerializationBinder联编程序)+270 System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph,Header [] inHeaders,__BinaryWriter serWriter,Boolean fCheck)+814 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter .Serialize(Stream serializationStream,Object graph,Header [] headers,Boolean fCheck)+32 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream,Object graph)+17 System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter作家,对象的值)3526
[ArgumentException的:错误序列化值 'I:0#.W | fsoft.fpt.vn \ hoavt2' 类型“微软。 SharePoint.SPUser。'] System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer,Object value)+4068 System.Web.UI.ObjectStateFormatter.Serialize(Object stateGraph,Purpose purpose)+103 System.Web.UI .Util.SerializeWithAssert(IStateFormatter2格式化程序,对象状态图,目的用途)+67 System.Web.UI。HiddenFieldPageStatePersister.Save()+173 System.Web.UI.Page.SaveAllState()1161 System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)4660
任何人都面临着这个问题, 请帮忙。