Service Pack 1 for SharePoint 2010 introduced a new method for the SPWeb object – Recycle(). This allows you to send a site to the recycle bin, rather than deleting it outright. I’ve used it before in Farm solutions without any issue.
However, I’m now working on a sandbox solution, and when I tried using it, I got the error:
MissingMethodException Method not found: ‘Void Microsoft.SharePoint.SPWeb_SubsetProxy.Recycle()’.
at Microsoft.SharePoint.SPWeb.Recycle__Inner()
at Microsoft.SharePoint.SPWeb.Recycle()
Hmm. That’s strange; my call to recycle seems fine, and the documentation says it’s available in the Sandbox, but internally there seems to be a missing method.
Out of curiousity, I tried using Delete() rather than Recycle(), and this worked correctly. So what gives? Continue reading “MissingMethodException when calling SPWeb.Recycle() in Sandbox solution”