I know I can empty the recycle bin for a site collection with the following:
public static bool EmptyRecycleBin(string siteCollection)
{
try
{
using (var site = new SPSite(siteCollection))
{
site.RecycleBin.DeleteAll();
}
return true;
}
catch (Exception ex)
{
Console.WriteLine("Exception: {0}", ex);
return false;
}
}
However this could cause issues and I'd like to only remove specific items (that I've deleted programatically) from here. Is there a way to do this or is it impossible?