Skip to content

Instantly share code, notes, and snippets.

View joshhebb's full-sized avatar
🤔
Thinking

Josh Hebb joshhebb

🤔
Thinking
View GitHub Profile
@joshhebb
joshhebb / SetPublishToChildrenDefault.config
Created July 16, 2019 14:47
Simple SDL Tridion / Web GUI extension to set an advanced publish setting by default.
<?xml version="1.0"?>
<Configuration xmlns="http://www.sdltridion.com/2009/GUI/Configuration/Merge"
xmlns:cfg="http://www.sdltridion.com/2009/GUI/Configuration"
xmlns:ext="http://www.sdltridion.com/2009/GUI/extensions"
xmlns:cmenu="http://www.sdltridion.com/2009/GUI/extensions/ContextMenu">
<resources cache="true">
<cfg:filters />
<cfg:extensiongroups>
<cfg:extensiongroup name="SetPublishToChildrenDefault">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml" exclude-result-prefixes="xhtml">
<xsl:output omit-xml-declaration="yes" method="xml" cdata-section-elements="script"></xsl:output>
<xsl:template match="/ | node() | @*">
<xsl:copy >
<xsl:apply-templates select="node() | @*"></xsl:apply-templates>
</xsl:copy>
</xsl:template>
@joshhebb
joshhebb / Read-AppData.ps1
Created July 16, 2019 01:31
Read and remove application data stored in a SDL Tridion Content Management database.
# Read the list of application IDs
Get-TcmApplicationIds
# Remove a specific piece of AppData by application ID (in this example, a Translation Manager configuration)
Remove-TcmApplicationData "tm:cache"
@joshhebb
joshhebb / AppDataExamples.cs
Last active July 14, 2019 19:11
A couple of helper functions to store and retrieve objects stored in Tridions application data. Useful for "caching" costly reports generated by the CoreService, but also just storing and retrieving C# objects in application data.
/// <summary>
/// Save an object in appData (stored in the CM DB) by serializing the object into a string,
/// then converting it to an array of bytes and storing it via the CoreService client.
/// </summary>
/// <param name="applicationId">The ID which the appData can be retrieved.</param>
/// <param name="data">The object to be stored in appData by applicationId.</param>
public void SaveAppData<T> (string applicationId, T data)
{
using (var client = new SessionAwareCoreServiceClient(""))
{