Currently I have this program:
namespace EmptySiteCollectionRecycleBin
{
class Program
{
static void Main(string[] args)
{
using (SPSite mySite = new SPSite("http://mysharepointsite"))
{
try
{
mySite.RecycleBin.DeleteAll();
if (mySite != null)
{
mySite.Dispose();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Console.WriteLine("Recycle bin emptied");
Console.WriteLine("Press any key to exit");
Console.ReadLine();
}
}
}
Can someone tell me how I can make sure that this remove all items from the "second stage recyclebin/AdminRecyleBin", as seen when you navigate to this url in SharePoint: _layouts/AdminRecycleBin.aspx?View=2
I see in looking at the methods, there is this:
mySite.RecycleBin.MoveAllToSecondStage();
Is there something like "DeleteAllFromSecondStage();"?
Or perhaps something like:
mySite.RecycleBin.BinType = SPRecycleBinItemState.SecondStageRecycleBin;