Last active
June 12, 2018 15:00
-
-
Save vaderj/5d209ea8ea33542286ee49d243469c6c to your computer and use it in GitHub Desktop.
reject a SP document #Javascript #REST #SharePoint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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