I'm trying to retrieving document ID of newly uploaded document using JQuery, any help highly be appreciated.
I'm trying below code which is not working error, 404 not found;
function getListData() {var docTitle = jQuery('#fileButton').val();
var fileCollectionEndpoint = String.format(
"{0}/_api/web/lists/getByTitle('Private%20Documents')/RootFolder/Files/Get(url='{1}', overwrite=true)",
_spPageContextInfo.webAbsoluteUrl, docTitle);
$.ajax({
url: fileCollectionEndpoint,
type: "GET",
headers: {
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
},
success: Succeeded,
error: function Failed() {
alert('Error!');
}
});
}
function Succeeded(data) {
var listItemInfo = "";
$.each(data.d.results, function (key, value) {
listItemInfo += 'ID: ' + value.Id +
';';
});
alert(listItemInfo);
}