Skip to content

Instantly share code, notes, and snippets.

jammykam / MediaRequestHandler.cs
Last active March 5, 2024 17:11
Custom Sitecore Media Request handler to deal with media items with the same name but different extensions. If the media with matching extension is not found then the default Sitecore behaviour is used. This is directly inspired by the post by Martin Davies:
using System.Web;
using Sitecore.Diagnostics;
using Sitecore.Resources.Media;
using System;
using System.Linq;
using Sitecore.Data.Items;
using Sitecore.IO;
namespace MyProject.Custom.Media
jammykam / SelectRendering.xml
Created December 22, 2015 20:32
Tabbed Rendering Selector
<?xml version="1.0" encoding="utf-8" ?>
<control xmlns:def="Definition" xmlns="">
<FormDialog ID="Dialog" Icon="Core/32x32/open_document.png" Header="Open Item"
Text="Select the item that you wish to open. Then click the Open button." OKButton="Open">
<Stylesheet Src="SelectItemWithThumbnails.css" DeviceDependant="true" />
<CodeBeside Type="MyProject.CMS.Custom.Dialogs.SelectRenderingTabbed.SelectRenderingForm, ARM.CMS.Custom"/>
<DataContext ID="DataContext" Root="/"/>
jammykam / MigrateLayouts.aspx
Created September 1, 2022 13:26
This script migrates the "old" layout format to the new format used in Sitecore 8.2 Update-7 and Sitecore 9 Update-2. Code from: updated to use ID rather than path
<%@ Page Language="C#" AutoEventWireup="true" Debug="true" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="Sitecore" %>
<%@ Import Namespace="Sitecore.Configuration" %>
<%@ Import Namespace="Sitecore.Data" %>
<%@ Import Namespace="Sitecore.Data.Fields" %>
<%@ Import Namespace="Sitecore.Data.Items" %>
<%@ Import Namespace="Sitecore.Globalization" %>
<%@ Import Namespace="Sitecore.Layouts" %>
jammykam / CreateUsers.ps1
Last active April 4, 2022 18:22
Create Users and Add to specified roles from CSV file using Sitecore PowerShell Extensions
$VerbosePreference = "Continue"
$newUsersFile = Receive-File -Path "C:\temp\upload" -CancelButtonName "No, I will do it using MS Excel instead"
$newUsers = Import-Csv -Path $newUsersFile
foreach($user in $newUsers) {
Write-Verbose "Creating User: $($user.Username)"
New-User -Identity $($user.Username) -Enabled -Password $($user.Password) -Email $($user.Email) -FullName "$($user.Name)"
$($user.Roles).Split(",") | ForEach {
jammykam / protobuf.filepath.config
Last active February 17, 2022 19:36
Patch the Sitecore Protobuf Filepath locations to look at module items (useful for Sitecore 10.1)
<?xml version="1.0" encoding="utf-8" ?>
Purpose: Adds in an additional location to load IAR files from
This config can be removed if the project is upgraded to 10.2+ since the path is set ootb
<configuration xmlns:patch="" xmlns:role="">
<database id="master" role:require="Standalone or ContentManagement">
jammykam / nuget.config
Created February 15, 2022 00:38
Sitecore nuget.config sources
<?xml version="1.0" encoding="utf-8"?>
Used to specify the default Sources for list, install and update.
<clear />
<add key="Nuget" value="" />
<add key="Sitecore Public Feed" value="" />
<add key="Sitecore Commerce Public Feed" value="" />
using Sitecore;
using Sitecore.Diagnostics;
using Sitecore.Resources;
using Sitecore.Web.UI;
using Telerik.Web.UI;
using Sitecore.Data.Items;
namespace RTEDropList
public class EditorConfiguration : Sitecore.Shell.Controls.RichTextEditor.EditorConfiguration
jammykam / Preview.Database.config
Created November 5, 2021 04:02
Sitecore 10.1+ additional Preview database config
<configuration xmlns:patch="" xmlns:role="" xmlns:security="">
<sitecore role:require="ContentManagement">
<eventQueue name="web_preview" patch:after="eventQueue[@name='web']" type="Sitecore.Data.Eventing.$(database)EventQueue, Sitecore.Kernel">
<param ref="dataApis/dataApi[@name='$(database)']" param1="$(name)" />
<param hint="" ref="PropertyStoreProvider/store[@name='$(name)']" />
jammykam / settings.json
Last active January 8, 2021 01:57
Konabos Microsoft Terminal Settings
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see:
"$schema": "",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
jammykam / Generate Anti-Update Rollback.ps1
Created January 24, 2017 09:39
Sitecore PowerShell script to generate an anti-update package as a TDS Post Deploy Script -
$tempFolder = [Sitecore.Update.Utils.FileUtils]::InstallationHistoryRoot
$historyFolder = [Sitecore.MainUtil]::MapPath($tempFolder)
#get the latest update folder
$latestUpdate = Get-ChildItem -Path $historyFolder | Sort-Object LastAccessTime -Descending | Select-Object -First 1
Write-Host $latestUpdate.FullName
[Sitecore.Update.Engine.PackageGenerator]::ConvertRollbackPackage( `
$latestUpdate.FullName + "\rollbackPackage.rlb", `
$latestUpdate.FullName + "\rollbackPackage.update")