public void CleanUnwantedLocalItems() { foreach (Guid id in AllowedItems) { try { var data = _sitecore.GetItemData(id); _logger.BeginEvent(data, LogStatus.Recycle, _sitecore.GetIconSrc(data), false); string status = $"{DateTime.Now:h:mm:ss tt} [RECYCLED] Recycled old item {data?.Name} - {id}"; _logger.LoggerOutput.Add(status); if (data != null) { _sitecore.RecycleItem(id); } } catch (Exception e) { _logger.BeginEvent(new ErrorItemData() { Name = id.ToString("B"), Path = e.ToString() }, LogStatus.Error, "", false); } } }
public void CleanUnwantedLocalItems() { foreach (Guid id in AllowedItems) { try { _sitecore.RecycleItem(id); var data = _sitecore.GetItemData(id); _logger.BeginEvent(data, LogStatus.Recycle, _sitecore.GetIconSrc(data), false); } catch (Exception e) { _logger.BeginEvent(new ErrorItemData() { Name = id.ToString("B"), Path = e.ToString() }, LogStatus.Error, "", false); } } }