Worklist in Winform C#

  • 14 August 2008
  • 1 reply
  • 2 views

Badge +1

Hi guys, another (probably) silly question, please forgive me for that.


I just need some code to get a workitem list for an specific user (from there I can get the ID) from a winform Aplication in C#


We're making a custom application that displays the list in a form, and we're not sure on which is the best approach.


Probably is easy with the blackpearl api, but can't find any code.


Thanks in advance


 


1 reply

Badge +4

Um, I'm going to paste together some separate bits of code, but hopefully this covers it:

        public Connection OpenConnection()
{
try
{
if (_K2ClientConnection == null)
{
_K2ClientConnection = new Connection();

ConnectionSetup connSetup = new ConnectionSetup();

connSetup.ConnectionString = _connectionStringProvider.ClientConnectionString;

// open a K2 connection
_K2ClientConnection.Open(connSetup);
}

return _K2ClientConnection;
}
catch (Exception ex)
{
throw ex;
}
}

public Worklist GetWorklist()
{
Connection conn = OpenConnection();

Worklist list = conn.OpenWorklist();

return list;
}

 


And then to do something with the worklist it looks something like:

            Worklist wl = GetWorklist();

foreach (WorklistItem item in wl)
{
//Do whatever
}

Hope that helps.

Reply