You may be interested in look at this How-To post:
It deals specifically with programatically retrieving List Item values that contain user IDs and using as destinations for an activity, but that being said, it does show how I was able to programmatically retrieve list item values from within K2. FYI, this was done with Sharepoint 2003.
For each item in a SharePoint list,an ID is associated with it.This ID is automatically generated when we add a List item. It is easy to get the item id after the item is added(either programtically or by viewing the ID column of the list).But how to get the ID of the item before the item is added to the list ?
Here is a solution to this problem.
public static int NextListItemID(SPSite oSite, Guid listId)
int listItemId = -1;
if (oSite.WebApplication.ContentDatabases.Count > 0)
//Get the connection string for the sharepoint database
string connString = oSite.WebApplication.ContentDatabases.DatabaseConnectionString;
//Establish a connection
SqlConnection con = new SqlConnection(connString);