Skip to content

Instantly share code, notes, and snippets.

@vaderj
Last active June 12, 2018 15:00
Show Gist options
  • Save vaderj/5d209ea8ea33542286ee49d243469c6c to your computer and use it in GitHub Desktop.
Save vaderj/5d209ea8ea33542286ee49d243469c6c to your computer and use it in GitHub Desktop.
reject a SP document #Javascript #REST #SharePoint
function rejectDocument(docId)
{
jQuery.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('Resource Library')/items(" + docId + ")/file/deny('Rejected')",
type: "POST",
headers: {
"accept": "application/json;odata=verbose",
"X-RequestDigest": jQuery("#__REQUESTDIGEST").val()
},
success: function(){
//myPostBack used for screen redraw without page refresh
//myPostBack("ctl00$ctl51$g_0b42fb8c_be40_4524_8125_b9ce66626c48$ctl03","");
},
error: function(jqxhr){
alert("Fail: Please refresh the page and try again. If this keeps occuring, please email . a screenshot of this dialog. Error sent by server:" + jqxhr.responseText);
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment