Skip to content

Instantly share code, notes, and snippets.

@dsolovay
dsolovay / Get-SitecoreReleaseNotes
Last active Aug 15, 2022
Download Sitecore release notes to hash table
View Get-SitecoreReleaseNotes
function Get-SitecoreReleaseNotes()
{
$links = (invoke-webrequest https://dev.sitecore.net/Downloads/Sitecore_Experience_Platform.aspx).Links
$versions = $links |? {$_.innerText -like 'Sitecore Experience Platform*' -and $_.InnerText -notlike '*and below*'} # https://www.howtogeek.com/124736/stupid-geek-tricks-extract-links-off-any-webpage-using-powershell/
$versionlinks = @{}
$versions |% { $versionLinks.Add($_.innerHtml, $_.href)}
$releaseNotes = @{}
$versionLinks.Keys |%{
$releaseNotesUrl = "https://dev.sitecore.net" + ($versionLinks[$_]).Trim(".aspx") + "/Release%20Notes"
Write-Verbose $releaseNotesUrl
View Searchtester.aspx
<%@ Page %>
<%@ Import namespace="Sitecore.ContentSearch" %>
<%@ Import namespace="Sitecore.ContentSearch.SearchTypes" %>
<html>
<body>
<form runat=server>
<!-- <asp:textbox runat=server id=tb1 /> -->
<asp:button runat=server text=Click onclick=DoSearch />
<script runat=server>
@dsolovay
dsolovay / CustomCampaignCreator.config
Created Dec 21, 2021
How to modify Campaign Creator to not embed IDs in campaign names
View CustomCampaignCreator.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:env="http://www.sitecore.net/xmlconfig/env/">
<sitecore >
<services>
<configurator type="CustomCampaignRepository.ServicesConfigurator, CustomCampaignRepository" />
</services>
</sitecore>
</configuration>
@dsolovay
dsolovay / ConfigureSitecore.cs
Last active Dec 10, 2021
Code samples for Part 2 of Sustainsys.SAML2 Sitecore Identity plugin
View ConfigureSitecore.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Claims;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
@dsolovay
dsolovay / CacheFixture.cs
Last active Oct 7, 2021
Illustrates zero-friction TDD ideas, use of Sitecore base classes, and tuple deconstructors
View CacheFixture.cs
using NSubstitute;
using Sitecore.Abstractions;
namespace UnitTestingDemo
{
internal static class CacheFixture
{
public static (CustomCacheFactory, BaseCacheManager, BaseSettings) CreateCache()
{
BaseCacheManager cacheManager = Substitute.For<BaseCacheManager>();
@dsolovay
dsolovay / parameters.xml
Created Sep 19, 2021
Simple WebDeploy parameter configuration
View parameters.xml
<?xml version="1.0" encoding="utf-8" ?>
<parameters>
<parameter name="Application Ribbon Home Label"
description="Label that appears in ribbon"
defaultvalue="Application name" >
<parameterEntry kind="TextFile" scope="_Layout.cshtml" match="Application name" />
</parameter>
</parameters>
@dsolovay
dsolovay / ConfigureSitecore.cs
Last active Dec 8, 2021
Sitecore Identity to Sustainsys Plugin
View ConfigureSitecore.cs
using IdentityServer4;
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.DependencyInjection;
using Sustainsys.Saml2;
using Sustainsys.Saml2.Configuration;
using Sustainsys.Saml2.Metadata;
using Sustainsys.Saml2.WebSso;
namespace SitecoreIdentitySamlDemo
{
@dsolovay
dsolovay / Make_IdentityServer.ps1
Last active Sep 14, 2021
SIF for creating a duplicate ID server (for dev testing, plugin development, etc.)
View Make_IdentityServer.ps1
# A subset of XP0_SingleDeveloper.ps1 for creating duplicate ID servers for plugin development.
# Note values marked "UPDATE FROM EXISTING" should be updated based on a working starting point ID server (installed using SIF or the
# graphical installer).
# The Prefix that will be used on SOLR, Website and Database instances.
$Prefix = "UPDATE FROM EXISTING"
# The root folder with the license file and WDP files.
$SCInstallRoot = "C:\ResourceFiles"
@dsolovay
dsolovay / ExtractGuids.ps1
Last active Oct 27, 2021
Get IDs from Sitecore 10.1 Upgrade scripts
View ExtractGuids.ps1
Param(
# Input file
[Parameter()]
[String]
$InputFile,
[Parameter()]
[Switch]
$FormatForSql
)
$output = Get-Content $InputFile | % {[Regex]::match($_, "^.{36}(.{36})").Groups[1].Value}
@dsolovay
dsolovay / ContactInfo.aspx
Created Nov 13, 2020
Get xConnect Contact ID (for use in Experience Profile, etc.)
View ContactInfo.aspx
<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Session Info</title>
</head>
<body>
<h1>Session Info</h1>