How i Can Update(Approve/Reject) a Task Item via SPService.

Dec 10, 2012 at 4:21 PM

I Plan to use SPSerices through out my project, currently i am provisoning Approve/Reject Button in my page, if user clicks then they will be routed to wrktskip.aspx page for approve/reject  task functionaity. i pass expected parameters (list id and item id). now users dont want to do go to seperate page from item page for approve reject functionality. instead they want to ave approve reject button at the item page itself. and i have got following c# code to implelment the functionality and it needs to leverage hash table concept. but i want to implement with spservice only not planning to introduce c#, is it possible to update the Approve Reject Functionality of Approval Process Worklfow designed in SPD.

 

   1: SPList timesheets = web.Lists["SampleList"];
<!--CRLF-->
   2: string listID = "";
<!--CRLF-->
   3: SPListItem item = timesheets.Items[0];
<!--CRLF-->
   4:  
<!--CRLF-->
   5: SPWorkflowTask taskedit = null;
<!--CRLF-->
   6: SPWorkflowTask task = item.Tasks[0];        
<!--CRLF-->
   7: taskedit = task;
<!--CRLF-->
   8:  
<!--CRLF-->
   9: if (taskedit == null)   // no matching task
<!--CRLF-->
  10:     return;
<!--CRLF-->
  11:  
<!--CRLF-->
  12: // alter the task
<!--CRLF-->
  13: Hashtable ht = new Hashtable();
<!--CRLF-->
  14: ht["TaskStatus"] = "#";    // Mark the entry as approved
<!--CRLF-->
  15:  
<!--CRLF-->
  16: SPWorkflowTask.AlterTask((taskedit as SPListItem), ht, true);

Thanks

Sundar

Coordinator
Dec 10, 2012 at 4:26 PM

Check out the operations in the Workflow Web Service. If it's not there, then SPServices can't help you. Ogf course, simply approving a task cna be sdome with the Lists Web Service.

M.