How to add a worklist item programmatically?

  • 15 June 2006
  • 1 reply
  • 2 views

Badge
Can anyone share a code sample of how to How to add a worklist item programmatically?

My problem is that I am using SharePoint DocumentLibrary document and its meta data, rather than InfoPath or a K2 smartForm. In this case your Destination user does not get any worklist item on his/her worklist.

My goal is to create work list items with a link back to the document in SharePoint.

1 reply

Badge +8
Hi Ben,

If you look at the code behind a default client event you can see that all you need to do is specify the URL to the document and call the K2.AddWorklist function. The only potential problem that I see is that in order to complete the item you will need the serial number. You might need to add code to this function that puts the serial number into the metadata for the document so that the code that completes the task is able to access the worklist item.

public void HTTPFunction(ClientEventContext K2)
{
string strURL = "";
strURL = "http://sharepointserver/sites/site/doclib/doc.doc";
//Add code to put K2.SerialNumber into the meta data for the doc
K2.AddWorklist("ASP",System.Web.HttpUtility.UrlPathEncode(strURL));
}

I hope this helps.

- Eric

Reply