I'm attempting to create a feature stapled solution that pushes out custom branding to every new site collection created. The following code is in my event receiver:
public override void FeatureActivated(SPFeatureReceiverProperties properties) { using(SPSite sitecollection = properties.Feature.Parent as SPSite) { using (SPWeb site = sitecollection.OpenWeb()) { foreach (SPWeb web in sitecollection.AllWebs) { try { SPList list = web.Lists.TryGetList("Composed Looks"); foreach (SPListItem item in list.Items) { if(item.Title != "Current" || item.Title != "Dynetics") { item.Delete(); item.Update(); } } } finally { if(web != null) { web.Dispose(); } } } } } } But when deploying the solution I get the error:
Error occurred in deployment step 'Activate Features': Item does not exist. It may have been deleted by another user. WHY??