Skip to main content
Hi all,

I write a sample code to test k2 web service, almost the same as sample code in web service document, but fail. Followint is the code:


K2FilterService.FilterService RptService = new K2WebServiceTest.K2FilterService.FilterService();
RptService.Credentials = System.Net.CredentialCache.DefaultCredentials;
txtUserName.Text = RptService.CreateSession("eccent", ""); // here i get the eccentrixadministrator
txtUserName.Text = txtUserName.Text.Replace(""
The line of code where you get the Report ID dataset, the GetID method receives an incorrect "ReportName" parameter:
DataSet ds = RptService.GetID(strParm, "All", txtUserName.Text);

Here you should enter the name of the report, e.g. for the Process Overview Report the line should be:
DataSet ds = RptService.GetID("Process Overview", "All", txtUserName.Text);


You may also want to check if the default report already exists before creating a new template session:
.Rows.Count == 0)
{
RptService.NewUserTemplate(txtUserName.Text);
ds = RptService.GetID("Process Overview", "All", txtUserName.Text);
}

thanks dc, now i know how to call K2 web service.

But i find a problem:
I wan to filter a specific process' instances such as ServiceRequest, so i transfer a param like "UserName:ECCENTRIXAdministrator|ProcName:ServiceRequest|Folder:ECCENTRIX", the result is: yes, i can view all ServiceRequest's instances, but at the same time, i get all other process' instances which i have admin and view privilege such as PurchaseRequest, eMR..., seems that filter condition here not function. Would you please tell me what's going on?

Regards,
karon
You may want to change your filter parameter. Use "Process_Name" instead of "ProcName", i.e.
string strParm = "UserName:EccentrixAdministrator|Process_Name:ServiceRequest|Folder:ECCENTRIX";

The easiest way to get the correct parameter name would be to see what the column name is in the result set of the particular column you want to filter on.

Reply