Is it just possible to store elementary data types in FormState[]? I want to do something like that:
private SPListItemCollection _memberVariable
{
get
{
return FormState["_memberVariable"] as SPListItemCollection;
}
set
{
FormState["_memberVariable"] = value;
}
}
and access it:
_memberVariable = list.GetItems(query);
Then I get the following exception:
System.Runtime.Serialization.SerializationException was unhandled by user code
Message="Serialization error."
Source="Microsoft.Office.InfoPath.Client.Internal.Host"
StackTrace:
at Microsoft.Office.InfoPath.Internal.FormStateBagHost.System.Collections.IDictionary.set_Item(Object key, Object value)
at CommunicationSet.FormCode.set__memberVariable(SPListItemCollection value) in (...)
Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)
at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)