Exemple #1
0
        public ActionResult GetItemYaml(string id)
        {
            Assert.ArgumentNotNullOrEmpty(id, "id");
            using (var stream = new MemoryStream())
            {
                Formatter.WriteSerializedItem(_sitecore.GetItemData(Guid.Parse(id)), stream);
                stream.Seek(0, SeekOrigin.Begin);

                using (var reader = new StreamReader(stream))
                {
                    return(Content(reader.ReadToEnd()));
                }
            }
        }
Exemple #2
0
 public void CleanUnwantedLocalItems()
 {
     foreach (Guid id in _allowedItems)
     {
         try
         {
             _sitecore.RecycleItem(id);
             var data = _sitecore.GetItemData(id);
             _logger.BeginEvent(data, "Recycle", _sitecore.GetItemIconSrc(data), false);
         }
         catch (Exception e)
         {
             _logger.BeginEvent(new ErrorItemData()
             {
                 Name = id.ToString("B"), Path = e.ToString()
             }, "Error", "", false);
         }
     }
 }