Skip to main content

I need to get the list of all smart objects. Further  i would like to get properties and methods in each smart object.


 


I tried 

 the Schema discovery option as in ADO.net and

tried using the SOConnection object GetSchema method. I tried different overloads but the NotSupported exception is thrown. An overload with no parameters too is throwing the same exception. I’m not sure if I’m missing anything.


 


Please provide the suggestions to obtain the list of smart objects and their members.

have you run the brokermanagement.exe found under k2 blackpearlservice broker?

you can try the  "view smart object definition" option. Also under the same directory on the k2 server you will find "smart object service tester.exe" which can provide the info you are looking for.


I have used these tools. I would like to get the information provided by these tools in a custom application.


I would like to get the list of smart objects at runtime programmatically. The requirement is for the dynamic list of smart objects and further extract the selected smart object's  properties and methods.


Hence I was looking at the ADO.net way of inferring the schema of smart objects in a given K2 workflow server.


Hi,


I suggest you use SourceCode.SmartObjects.Management API (please look at the help file for more details - K2 Blackpearl chm >> K2 developer reference >> Class Library reference >> SourceCode.SmartObjects.Management Assembly).


Also, you can have a look at the source code of K2 blackpearl] AJAX, ASP.net API Example blackmarket project : A fully functional Microsoft AJAX and ASP.net enabled application which shows how to interact with K2 blackpearl] via the API's. API’s demonstrated are: • Worklist API with search criteria • Process Management API • Reporting via Microsoft SQL Server Reporting Services (“SSRS”) • SmartObjects with a dynamic user interface based on the entity meta-data. This caters for associations and validation All K2 specific code has been relocated to a helper class called Common which manages connections and builds dynamic interfaces. This class has been designed to be added to subsequent projects along with its supporting javascript file and stylesheet.


HTH.


We are doing exactly the same thing that you are describing.  I used the following to accomplish this:


SmartObjectManagementServer smartObjectServer =

new SmartObjectManagementServer();


smartObjectServer.CreateConnection();


smartObjectServer.Connection.Open((ConnectionString]);


 // Bind all smart objects to a list


lbSmartObjects.DataSource = smartObjectServer.GetSmartObjects(SmartObjectInfoType.User).SmartObjects;


lbSmartObjects.DisplayMember =

"Name";


lbSmartObjects.ValueMember =

"Name";


The 'SmartObject' object contains accessors to methods and properties of the smart object:


foreach (SmartPropertyInfo property in nSmartObject].Properties)


Reply