We are new to K2 (just had it installed last week) and are trying to start a process via .NET code. It works when I debug locally but doesnt work when I publish it to our IIS server. I'd like to start a process using the logged in users credentials (domainusername) which works fine when debugging from my dev workstation. K2 server seems to be reading the user as the apppoolidentity account (IIS APPPOOL). I've tried Network Service and Local Service accounts but havent had luck. It seems simple enough. Here is my code:
SCConnectionStringBuilder connectionString = new SCConnectionStringBuilder();
connectionString.Host =
"myservername here";
connectionString.Port = 5252;
connectionString.Integrated = true;
connectionString.IsPrimaryLogin =
true;
Connection connection = new Connection();
//to test which account is being used
string k2username = String.Empty;
try{
connection.Open("myservername here", connectionString.ToString());
k2username = connection.User.DisplayName;
ProcessInstance processInstance = connection.CreateProcessInstance("K2Project1TestProject");
processInstance.Folio = System.DateTime.Today.ToString();
connection.StartProcessInstance(processInstance,
false);}
catch (Exception ex)
{
//some exception handling here
}
finally
{ connection.Close();
}