Re: Worklist in Winform C#

  •  08-14-2008, 10:48 AM

    Re: Worklist in Winform C#

    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.
    Colin
    K2 Insider
    K2 Blog: K2 Thought
View Complete Thread