How to get and update the worklistitems of a user in K2.NET 2003 process using K2ROM

  • 6 October 2008
  • 4 replies
  • 0 views

Badge +2

Hi,


Our requirement is to create sharepiont task list for list of users (user1 , user2 ...so on) in k2.net 2003 process client events. I'm able to add the sharepoint tasks and worklistitems to K2 process, But not sure how to get the worklistitems of user in web application and update them using K2ROM.


These tasks are updated asynchronously. Please provide me some code snippets...I tried with some code but no luck...I appreciate your helo.


 


Thanks,


SP


4 replies

Badge +3

Here is an example derived from the K2.net 2003 documentation:


    SourceCode.K2ROM.Connection oK2Connection = new SourceCode.K2ROM.Connection(); 
    SourceCode.K2ROM.Worklist oWorkList;  
    string K2Server = "localhost";
    
        //------------------------------------------------------------------- 
        //Worklist for current Logged on user as specified in the Connection 
        //------------------------------------------------------------------- 
 
        //Open Connection 
        oK2Connection.Open(strK2Server); 
 
        //Get Worklist for current Logged on User 
        oWorkList = oK2Connection.OpenWorklist("ASP"); 
 
        foreach(SourceCode.K2ROM.WorklistItem oWorkListItem in oWorkList) 
        { 
            
                //Update Process Data or XML Field 
                oWorkListItem.ProcessInstance.DataFields["Result"].Value = "Complete"; 
                
                //Update Activity Data or XML Field 
                oWorkListItem.ActivityInstanceDestination.DataFields["Result"].Value = "Complete"; 
                
                oWorkListItem.Update(); 
                //OR 
                oWorkListItem.Finish(); 
            } 
            
 

Does this help?  Let me know if you are asking for something different.

Regards,
Sam 

Badge +2

Thanks Sam, It worked out to me with couple of changes.....


Thanks for the support.


SP

Badge

I'm new at this


where can I get more info about this?


oWorkListItem.Update(); 
                //OR 
                oWorkListItem.Finish();


 


is it just a method to update my value?


 


Thank you

Badge +13

The Update method is called to update the associated
instance of the WorklistItem or
ServerItem.


 


The Finish method is called to update and complete the associated
ServerItem.


C:Program Files (x86)K2.net 2003HelpK2ROM.chm

Reply