Skip to content

Instantly share code, notes, and snippets.

@lowedown
lowedown / ApplySendingSettings.cs
Last active August 29, 2015 14:01
Globally override Web Forms for Marketers Email Sending settings.
using System;
using System.Net;
using Sitecore.Form.Core.Pipelines.ProcessMessage;
namespace MyProject.Forms
{
/// <summary>
/// Overrides Web forms for marketers mail settings through global configuration options.
/// </summary>
public class ApplySendingSettings
@lowedown
lowedown / FetchContextIndexByField .cs
Last active August 29, 2015 14:01
Sitecore Pipeline to set custom context index through a field
using Sitecore.ContentSearch.Pipelines.GetContextIndex;
namespace Playground.Search.Pipelines
{
public class FetchContextIndexByField : GetContextIndexProcessor
{
public override void Process(GetContextIndexArgs args)
{
if (args == null)
return;
@lowedown
lowedown / AppliedIndexChecker.aspx
Last active August 29, 2015 14:01
Sitecore admin page that checks the resolved Context Index for a specific item.
<%@ Page Language="C#" AutoEventWireup="true" EnableViewState="false"%>
<%@ Import Namespace="Sitecore.ContentSearch" %>
<%@ Import Namespace="Sitecore.Data" %>
<%@ Import Namespace="Sitecore.Data.Items" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Applied Index Checker</title>
</head>
@lowedown
lowedown / ViewJobs.aspx
Last active April 11, 2016 20:38
Sitecore Admin Page to show currently running Jobs
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="Sitecore.Jobs" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Running Sitecore Background Jobs</title>
<meta http-equiv="refresh" content="3" />
@lowedown
lowedown / AuthenticatedPublishAgent.cs
Last active August 29, 2015 14:03
Extension of a Sitecore PublishAgent to run publish jobs under a specific user
public class AuthenticatedPublishAgent : PublishAgent
{
private readonly string _userName;
public string UserName
{
get
{
return this._userName;
}
@lowedown
lowedown / AssociateCampaignToVisit.cs
Created July 11, 2014 07:25
Hook for the triggerCampaign pipeline to always associate a campaign to a visit.
public class AssociateCampaignToVisit : TriggerCampaignProcessor
{
public override void Process(TriggerCampaignArgs args)
{
Assert.ArgumentNotNull((object)args, "args");
// Always associate the campaign to the current visit when triggered
Sitecore.Analytics.Tracker.CurrentVisit.CampaignId = args.Definition.ID.ToGuid();
}
}
@lowedown
lowedown / Minimal FieldMap
Created August 9, 2014 22:04
Minimal FieldMap Configuration
<fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch">
<fieldNames hint="raw:AddFieldByFieldName">
<!-- Add custom fields here -->
<field fieldName="MyCustomField" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="4f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider" />
<!-- System fields to allow correct mapping -->
<field fieldName="_uniqueid" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
<analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.LowerCaseKeywordAnalyzer, Sitecore.ContentSearch.LuceneProvider" />
</field>
@lowedown
lowedown / gist:7cc68e593d184ed41e71
Created October 30, 2015 15:24
Minimal Sitecore Index configuration with language
<myLanguageSearchConfiguration type="Sitecore.ContentSearch.LuceneProvider.LuceneIndexConfiguration, Sitecore.ContentSearch.LuceneProvider">
<indexAllFields>false</indexAllFields>
<initializeOnAdd>true</initializeOnAdd>
<analyzer ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/analyzer" />
<fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch">
<fieldNames hint="raw:AddFieldByFieldName">
<!-- Needed for updating documents in the index -->
<field fieldName="_uniqueid" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
<analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.LowerCaseKeywordAnalyzer, Sitecore.ContentSearch.LuceneProvider" />
</field>
@lowedown
lowedown / MultiSiteRichTextEditorProfile.config
Last active March 4, 2016 17:04
Custom Editor Configuration allowing you to set RichText Editor Profiles per Site instead of using the global "HtmlEditor.DefaultProfile" setting.
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<!-- Set custom RichText Configuration Type to allow multi site configuration -->
<setting name="HtmlEditor.DefaultConfigurationType" value="MyProject.MultiSiteRichTextConfiguration,MyProject"/>
<setting name="MultiSiteRichTextConfiguration.DefaultDatabase" value="master"/>
<setting name="MultiSiteRichTextConfiguration.CoreDatabase" value="core"/>
@lowedown
lowedown / ProxyTest.aspx
Created April 13, 2016 16:13
Sitecore Admin Page to test accessing URLs
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Threading.Tasks" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Test Proxy Settings</title>