Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Using REST to approve a list item

$
0
0

I am pretty sure I already know the answer to this, but I am hoping someone here can say if its a bug or not and maybe get some visibility in MS on this issue.

I am trying to approve a list item via JavaScript using the REST interface. I know how to do it with CSOM, but in this scenario I am crossing site collection boundaries and CSOM won't let you do that. I have tried setting _ModerationStatus, _moderationstatus, ows_ModerationStatus, and 'Approval Status' to 0 but I keep getting an error that the column is not a valid column on the list item type. Does anyone know of something special that can be done to get to some of the 'special' fields on a list item? My test code for reference.


function example() {
    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        processData: false,
        beforeSend: function (xhr) {
            xhr.setRequestHeader("If-Match", "*");
            xhr.setRequestHeader("X-HTTP-Method", 'MERGE');
        },
        url: "http://myserver/sites/full/path/to/site/_vti_bin/listdata.svc/MyList(1)",
        data: "{'ows_ModerationStatus':0}",
        dataType: "json",
        error: function (xhr) {
            alert(xhr.status + ": " + xhr.statusText);
        },

        success: function () {
            alert("success");
        }
    });
}

The exact error I am getting is:

"Error processing request stream. The property name 'ows_ModerationStatus' specified for type 'Microsoft.SharePoint.DataService.MyCustomItem' is not valid."


Viewing all articles
Browse latest Browse all 11571

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>