I want to move (copy) a file to recycle bin without remove it from SharePoint Library..

I know that splistItem.Recycle() can remove a file to recycle bin. However, i don't want to delete it..

Do SharePoint provide a feature to copy a file to recycle bin?

  • 2
    just out of curiosity .... why you want to move / copy file to recycle bin ? Nov 15 '16 at 6:21
  • @MonicaJagani I have to modify that file so that I want to make a copy of it.
    – king yau
    Nov 15 '16 at 6:31

You cannot move file to recycle bin without deleting it from source library, also it does not make sense to move a file to recycle bin just because file needs to be modified and wanted to make copy of it. Below will make sure you have copy of file somewhere in SharePoint before you modify it.

  1. Enable versioning on document library, so every time it is modified a backup file is created automatically.
  2. Create a temporary library and move file there(this library can be your own recycle bin).Write some code/workflow to move files from one library to another based on user actions.
  • Why the file will not be sent to recycle bin when I replace it by uploading my edited file?
    – king yau
    Nov 15 '16 at 7:48
  • it does not work that way, when you replace old file, it will either create a new version of file or just replace it based on whether versioning is enabled or not on the library. Nov 15 '16 at 14:49

Not sure if we can directly copy to recycle bin, but as a workaround

  1. Copy to another temp library and delete the copied item from temp library.
  2. Copy to another library, delete original item, copy back from temp folder to original folder.

For copy and delete, do manually or use SPD workflow.


to add a bit more on a couple already good answers:

sounds like you want "full fidelity" which is hard because an item has a unique id.

you would have to - for example - save the list as a template and include the content to ensure an exact copy of the original item.

other than that, depending on what you actually want to do (which should be the main driver) you can either create a copy of the item (and then do whatever with any of the two) or upload the new item as a new version of the existing item, which would allow you to back track to any previous versions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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