Im programatically approving approval task. Im using this code:
ht[SPBuiltInFieldId.Completed] = "TRUE";
ht["Completed"] = "TRUE";
ht[SPBuiltInFieldId.PercentComplete] = 1.0f;
ht["PercentComplete"] = 1.0f;
ht["Status"] = "Completed";
ht[SPBuiltInFieldId.TaskStatus] = SPResource.GetString(new CultureInfo((int)openTask.Web.Language, false), Strings.WorkflowStatusCompleted, new object[0]);
ht[SPBuiltInFieldId.FormData] = SPWorkflowStatus.Completed;
ht[SPBuiltInFieldId.WorkflowOutcome] = "Schváleno"//Approved in czech language;
ht[SPBuiltInFieldId.TaskStatus] = "Schváleno";//Approved in czech language;
ht["TaskStatus"] = "Schváleno";//Approved in czech language;
Ref: Approve a SharePoint workflow task using SharePoint Web Services / Object Model
Everything works but i think this code is uggly:
first of all I dont understand why is nessery to define value for SPBuiltInFieldId.TaskStatus and "TaskStatus"? But when I remove "TaskStatus" task is not approved. I see that SPBuiltInFieldId.TaskStatus is secial id of field but why it not write value to "TaskStatus" field?
My second bigger problem is why I need to put value of TaskStatus in sharepoint instalation language string form. As you can see my sharepoint is localized to czech language. But when I will move to another sharepoint instance (slovak, english...) this code stop to work correctily.
Is there any option to get language string of text "Approved" in sharepoint installation language? something like SPBuiltInFieldId.TaskStatus?