Categories

Archive

compareRevisions – very important!

When performing a publish action programmatically (from C#), you would usually call: Sitecore.Publishing.PublishManager.PublishItem(itemToPublish, publishingTargets, languages, true, true); The last parameter in this method call is a bool, compareRevisions.  If you set this parameter to false, Sitecore will perform a Republish. Read more ›

Force Download of Sitecore Media Item

Here’s some sample code that will force the download of a Sitecore Media Item. MediaItem mi = CurrentDB.GetItem(“/sitecore/media library/Files/Misc/Jim_Beam_vs_Cuervo”); Stream fileStream = mi.GetMediaStream(); byte[] buffer = new byte[fileStream.Length]; fileStream.Read(buffer, 0, (int)fileStream.Length);fileStream.Close(); Response.ContentType = mi.MimeType;Response.AddHeader(“content-disposition”, “attachment; filename=” +mi.DisplayName + “.” + Read more ›