Recycle Bin

Recycling methods and dealing with recycle bin

You can work with recycle bins via REST API similarly as with lists.

Getting deleted items

data, err := sp.Site().RecycleBin().
	OrderBy("DeletedDate", false).
	Top(5).
	Get() // site's Recycle Bin
// data, err := sp.Web().RecycleBin().Get() // web's one
if err != nil {
	log.Fatal(err)
}

for _, item := range data.Data() {
	d := item.Data()
	fmt.Println(
		d.ID,
		d.ItemType,
		d.LeafNamePath.DecodedURL,
		d.DeletedByName,
		d.DeletedDate,
	)
}

Items in recycle bins are queryable collection, OData modifiers can be applied in a usual way.

Response is strongly typed, helps do not care about unmarshalling the structures. Items in recycle bin contains the following metadata:

Once you have Item ID (which is a GUID in case of recycle bin) you can not resore it.

Restoring recycled items

Last updated

Was this helpful?