I have below code , but it gives mentioned error on ExecuteQuery() after item.DeleteObject().

Site collSite1 = _ctx1.Site;
RecycleBinItemCollection collRBI1 = collSite1.RecycleBin;

RecycleBinItem item = collRBI1.SingleOrDefault(coll => coll.Id.ToString() == Id); //Here Id will have some value like "9aff6090-aecc-4342-a3a6-c2ecd957daee"


I also tried by putting this in web.config as per some solution in searching but failed.

add key="aspnet:MaxHttpCollectionKeys" value="20000"

Any idea what this issue is about?


1 Answer 1


There is no need to load RecycleBinItem collection, use RecycleBinItemCollection.GetById method to get Recycle Bin item by the specified identifier from the collection.

The following example demonstrates how to find RecycleBinItem by identifier and delete it:

var recycleBinItemId = new Guid("recycle bin item guid");
var recycleBinItem = ctx.Site.RecycleBin.GetById(recycleBinItemId);

Key points:

  • Allows to delete RecycleBinItem using a single request to a server
  • Thanks Vadim for reply, I applied your given code but still it shows the same Error on ctx.ExecuteQuery().
    – Kb15
    Oct 2, 2014 at 11:48

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.