Form ASP.NET (SmartObject [Departments] could not be found.)


Badge +8

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) {



2 replies

Badge +6

You can verify the smart object name (not display name) in SMO tester . Open SMO tester --> right click on SMO --> select “View XML”.


 


 

Badge +10

If you have changed your smartobject name after deployment through visual studio and redeployed after a smartobject name change then the name of the smartobject in the K2 database remains the old value. This maybe causing the issue in additio to the previous post.

Reply