以下返回作者的代码不适用于基于核心服务的工作流程。
并且没有给出任何错误。有什么建议么?
public void BackToAuthor(string workitemid)
{
var client = new CoreServiceSession();
var csClient = client.GetClient();
var readoption = new ReadOptions();
var workitem = (WorkItemData)csClient.Read(workitemid, readoption);
var processInstance = (ProcessInstanceData)csClient.Read(
workitem.Process.IdRef, readoption);
var ieActivities = processInstance.Activities;
if (ieActivities != null)
{
var targetactivity = (ActivityInstanceData)csClient.Read(
processInstance.Activities[0].Id, readoption);
var finishData = new ActivityFinishData();
finishData.Message = "Finished automatically";
finishData.NextAssignee = new LinkToTrusteeData {
IdRef = processInstance.Activities[0].Performers[0].IdRef,
Title = processInstance.Activities[0].Performers[0].Title };
csClient.FinishActivity(targetactivity.Id, finishData, readoption);
logdetails("Finished the activity");
csClient.Close();
}
}