I have created a smartobject that reads from a list in Sharepoint and returns the values in the list. If I call this smartobject inside the process using a Data Event it finds and uses the data just fine, but when attempting to call the SmartObject from CodeBehind I receive the following error.
SourceCode.SmartObjects.Client.SmartObjectNotFoundException: SmartObject [Departments] could not be found.
The code looks like:
public
string _user = ConfigurationManager.AppSettings["Username" ];
string _domain = ConfigurationManager.AppSettings["WindowsDomain" ];
string _serverName = ConfigurationManager.AppSettings["K2Host" ];
uint _port = Convert.ToUInt32(ConfigurationManager.AppSettings["SmartObjectPort"]);
SmartObjectClientServer serverName = new SmartObjectClientServer ();
// build a connection string
connectionString.Authenticate =
connectionString.Host = _serverName;
connectionString.Integrated =
connectionString.Port = _port;
connectionString.UserID = _user;
connectionString.WindowsDomain = _domain;
connectionString.Password = _password;
connectionString.SecurityLabelName =
//the default label
// open a K2 Server connection
serverName.CreateConnection();
serverName.Connection.Open(connectionString.ToString());
SmartObject smartObject = serverName.GetSmartObject(SmartObjectName);
smartObject.MethodToExecute = getList.Name;
SmartObjectList _sol = serverName.ExecuteList(smartObject);
{
_arrayList.Add(
}
{
_arrayList.Add(_so.Properties[SmartObjectProperty].Value);
}
_arrayList.Sort();
_arrayList.Sort();
serverName.DeleteConnection();
return _arrayList;if (NeedSelect) " --Select" ); foreach (SmartObject _so in _sol.SmartObjectsList) SmartListMethod getList = smartObject.ListMethods[ListMethod]; true; true;
connectionString.IsPrimaryLogin =
true; "K2"; SCConnectionStringBuilder connectionString = new SCConnectionStringBuilder (); ArrayList _arrayList = new ArrayList (); string _password = ConfigurationManager.AppSettings["Password"]; static ArrayList MakeDropdownArrayList(string SmartObjectName, string ListMethod, string SmartObjectProperty, bool NeedSelect) {