In server side object model, we have Recycle method to send the deleted list item attachment to the recycle bin.

With this method, users can always restore deleted attachment from the recycle bin.

This recycle method is available in REST for "list item", but I could not find any reference for "list item attachment".

Is there an equivalent method in JavaScript Object Model or REST API for attachment in SharePoint on-premises?

1 Answer 1


You need to append recycleObject to the attachment endpoint to send them to the recycle bin.

The REST endpoint would be as:


Using jQuery, you can do that as:

var attachEndPoint = _spPageContextInfo.webAbsoluteUrl + 

  url:  attachEndPoint,
  method: 'DELETE',
  headers: {
    'X-RequestDigest': $('#__REQUESTDIGEST').val()
  success: function(data){
  error: function(data){

If you are using PnP JS, then you can use it :

import pnp from "sp-pnp-js";

let item = pnp.sp.web.lists.getByTitle("Test").items.getById(1);

item.attachmentFiles.getByName("test.docx").recycle().then(v => {


If you want to send multiple attachments to recycle bin, then you can use it as:

const list = pnp.sp.web.lists.getByTitle("Test");

list.items.getById(1).attachmentFiles.recycleMultiple("test.docx","test2.pdf").then(r => {
  • Thanks for the response. I tried RecycleObject, it is throwing error "Cannot find resource for the request RecycleObject". I tried in SharePoint 2013 on-prem. Did it work for you in on-prem or online?
    – Suresh C
    Apr 27, 2018 at 8:50
  • 1
    I tried it on SharePoint online and it works. Unfortunately, have no way to testing this on OnPrem 2013. Maybe it will work with the latest CU. I used this code a couple of months back in SPO so this endpoint might have been added later on in the OnPrem CU Apr 27, 2018 at 12:59
  • Gautam, yes I tried in Online and it works. Unfortunately, this is not available in on-prem environment. I've also edited the question to mention the environment. Thanks for the tip. I'll accept your response as answer as it is indeed the REST equivalent for deleting the attachment. Hope, Microsoft makes it available for on-prem as well.
    – Suresh C
    Apr 28, 2018 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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