Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

How can I approve a workflow task using the ListData.svc? I am attempting to just set the value of ApprovalValue to "Approved" but this is not working at all. Any help you can give will probably save my day!

When I set the Approval to:

{"Value": "Approved"}

I get the following error:

"Error processing request stream. Deep updates are not supported in PUT operations."

UPDATE

I have discovered that I can change an item as expected if and only if the item is first approved via the GUI. I have no explanation as to why. If I create an approval item and then approve it using PowerShell

$list = $web.Lists["PAR_Tasks"]
$item = $list.GetItemById(1);

$item["Approval"] = "Rejected";
$item["RejectionReason"] = "Blah"
$item.Update();

and then go back and try to change ANY field using ListData.svc I receive a server 500 error and no information is logged. If I approve it in GUI and then change the value of a field using ListData.svc the item is updated - I can change any field's value I wish.

Any task item that is NOT generated by the WF I can edit just fine by sending a POST with MERGE and

{
    "ApprovalValue":"Approved"
}

as the payload.

I have tested this on 3 different environments and even on the out-of-the-box approval workflow on our department's production site. I get the same results every time. It appears you cannot approve or even change a workflow-generated task item using the ListData.svc Any manually generated item is fine.

Current Conclusion from Testing

My conclusion is that you must use a hybrid approach of ListData.svc with the ECMA CSOM to get the full range of functionality. I won't set this as an answer until it can be confirmed by someone smarter than me, though.

If any of you could take the time to test my theory, please do and I will give you the rep for the answer!

Also confirmed same behavior in SP 2013 using ListData.svc on a CloudShare instance!

share|improve this question
    
Were you able to resolve this error? –  Ryan Erickson Apr 1 '13 at 23:45
    
Community, confirm my findings and the bounty is yours! –  Robert Kaucher Apr 17 '13 at 1:04
1  
I just wanted to update this and mention we did submit a bug report to Microsoft. It has been confirmed and escalated to the product team. –  Robert Kaucher Jul 2 '13 at 18:32
    
I have been informed the Sp product team is looking at this issue now. Bug may actually get fixed! –  Robert Kaucher Nov 6 '13 at 21:58
add comment

2 Answers

up vote 0 down vote accepted
+50

Update
I can confirm that I receive a server 500 error when attempting to edit a WF generated task with ListData.svc. Some things I haven't looked at yet is comparing that to a task I created and seeing if there are permission differences. Also a 500 error should be generating an error in the log but I can't find anything there either.

Original Proposal:

Try changing the operation to a MERGE operation. See this MSDN article: http://msdn.microsoft.com/en-us/library/ff798339.aspx

beforeSendFunction = function (xhr) 
{
  xhr.setRequestHeader("If-Match", inventoryLocation.__metadata.ETag);
  // Using MERGE so that the entire entity doesn't need to be sent over the wire. 
  xhr.setRequestHeader("X-HTTP-Method", 'MERGE');
}
share|improve this answer
    
Ryan, sorry it took so long. I looked at my code again and I was in fact using 'MERGE'. I am going to do a little more work with this and I will update the question. Currently I have just swapped the update portion of my code out for ECMA CSOM. –  Robert Kaucher Apr 11 '13 at 21:31
    
Ryan, I've added some additional details. –  Robert Kaucher Apr 16 '13 at 19:51
    
updated the answer but I wasn't able to find anything new –  Ryan Erickson Apr 17 '13 at 18:39
    
I am going to move your update to the top so no one mistakenly thinks the MERGE header was the answer. 50 points is worth it for showing that I am not crazy! Has anyone got a 2013 environment they could test the new API service for this? –  Robert Kaucher Apr 17 '13 at 19:12
add comment

I'm not smart enough to verify this, but you might be able to easily enough: http://aka.ms/cloudlab pointed me to this article:

Step-by-Step: Build a FREE SharePoint 2013 Lab in the Cloud with Windows Azure Infrastructure Services

share|improve this answer
    
I'm sure you are smart enough! I had already spun up a cloud share instance and confirmed it. But thank you for mentioning this as I am constantly forgetting I have access to Azure via my MSDN subscription. –  Robert Kaucher Apr 18 '13 at 12:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.