Skip to content

Instantly share code, notes, and snippets.

View ReadonlyBlocks.cs
using System;
using System.Collections.Generic;
using EPiServer.Core;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.Shell.ObjectEditing;
namespace Foundation.Features
{
public class ReadonlyBlockMetadataExtender : IMetadataExtender
View ProjectUndoInit.cs
using System;
using System.Collections.Generic;
using System.Linq;
using EPiServer;
using EPiServer.Core;
using EPiServer.Data.Entity;
using EPiServer.DataAbstraction;
using EPiServer.DataAccess;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
View OrderEventsInit.cs
using EPiServer.Commerce.Order;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
namespace Foundation._EuromonitorExample
{
[InitializableModule]
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
public class OrderEventsInit : IInitializableModule
{
@davidknipe
davidknipe / MigrateContentToGetaCategoriesJob.cs
Last active Oct 13, 2019
Migrates content to use Geta Categories. Note will only migrate categories that exist in the Geta Categories structure.
View MigrateContentToGetaCategoriesJob.cs
using System.Collections.Generic;
using System.Linq;
using EPiServer;
using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.PlugIn;
using EPiServer.Scheduler;
using EPiServer.Security;
using Foundation.Cms.Categories;
using Geta.EpiCategories;
@davidknipe
davidknipe / CreateGetaCategoriesFromEpiserverCategoriesJob.cs
Created Oct 10, 2019
Create Geta Categories based on existing Episerver category structure
View CreateGetaCategoriesFromEpiserverCategoriesJob.cs
using System.Collections.Generic;
using System.Linq;
using EPiServer;
using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.PlugIn;
using EPiServer.Scheduler;
using Foundation.Cms.Categories;
using Geta.EpiCategories;
using Geta.EpiCategories.Extensions;
@davidknipe
davidknipe / PostClickInterceptor.cs
Last active Aug 6, 2019
Episerver tracking data interceptor to create Episerver Campaign post clicks from Episerver Insight tracking events
View PostClickInterceptor.cs
using System.Configuration;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Hosting;
using Episerver.Marketing.Common.Helpers;
using EPiServer.ServiceLocation;
using EPiServer.Tracking.Commerce.Data;
using EPiServer.Tracking.Core;
using EPiServer.Tracking.PageView;
@davidknipe
davidknipe / ReplacementTokenProperty.cs
Last active Mar 27, 2019
Tokenised Content in Episerver
View ReplacementTokenProperty.cs
using System.ComponentModel.DataAnnotations;
using EPiServer.Core;
using EPiServer.PlugIn;
namespace TokenisedContent.Features.TokenisedContent
{
[PropertyDefinitionTypePlugIn]
public class ReplacementTokenProperty : PropertyList<ReplacementToken> { }
public class ReplacementToken
@davidknipe
davidknipe / AddMetaClass.cs
Created Mar 5, 2015
Create an EPiServer Commerce Metafield programmatically and add it to a Metaclass in Business Foundation
View AddMetaClass.cs
/// <summary>
/// Programmatically create a new MetaField on the Contact MetaClass <seealso href="http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Commerce/8/Business-Foundation/Business-Meta-Model/MetaField-class/"/>
/// </summary>
private void setupMetaField()
{
MetaClassManager metaModel = DataContext.Current.MetaModel;
foreach (MetaClass mc in metaModel.MetaClasses)
{
if (mc.Name == "Contact")
{
View TrackEmailClick.cs
public static void TrackEmailClick(HttpContextBase httpContext, EPiServer.Tracking.Core.ITrackingService trackingService)
{
try
{
var email = GetCurrentUserEmail();
// If you know the users name and/or additional information
// like company name it's also possible to associate here
var userData = new UserData() { Name = email, Email = email };
var trackingData = new TrackingData<object>
{
@davidknipe
davidknipe / InsightCommandLine.cs
Last active Oct 12, 2018
Example of using the Episerver Profile store API
View InsightCommandLine.cs
using Newtonsoft.Json.Linq;
using RestSharp;
namespace InsightClient
{
class Program
{
private static string deviceId = "<deviceid>"; // retrive from _madid cookie value
private static string apiRootUrl = "<apiRootUrl>"; // get from Insight / Profile store developer portal
private static string subscriptionKey = "<subscriptionKey>"; // get from Insight / Profile store developer portal
You can’t perform that action at this time.