What is a difference between DeleteObject() and Recycle() methods for SP.Folder
Asked Answered
C

2

5

Could anybody help me to understand a difference between DeleteObject() and Recycle() methods for SP.Folder?

I found this documentation, but it's not clear for me.

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfolder.recycle.aspx

Cobblestone answered 18/11, 2012 at 11:5 Comment(0)
A
5
Delete()

delete permanently without using the recycle bin.

to move item to recycle bin use

Recycle();

http://nickgrattan.wordpress.com/2007/10/09/spfolder-splist-deleting-versus-recycling/

Arni answered 18/11, 2012 at 11:9 Comment(2)
Thank you! I missed, that SharePoint has a recycle bin on a Site Settings page. That is a gr8 feature!Cobblestone
It was not obvious for me, but after some investigation I found that after just List.Recycle(); llist is not being deleted. Instead, ClientContext.Web.Context.HasPendingRequest becomes true and you need to call ClientContext.Web.Context.ExecuteQuery(); finally to execute the recycle query.Othilie
S
5

SharePoint maintains a recycle bin like a windows OS, that we can use it through our code for temporary deletion. I used Recycle() in one of our project. When we use Delete() or DeleteObject() it deletes the item directly without putting them in recycle bin but if you use Recycle() method it will send the item in recycle bin.

Shiv Tomar

[email protected]

http://www.tekritisoftware.com/brochure/Microsoft-Sharepoint-Development

Surfboat answered 19/11, 2012 at 9:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.