Skip to content

Instantly share code, notes, and snippets.

View fluxdigital's full-sized avatar

Adam Seabridge fluxdigital

View GitHub Profile
# Add the Sitecore MyGet repository to PowerShell
Register-PSRepository -Name SitecoreGallery -SourceLocation https://sitecore.myget.org/F/sc-powershell/api/v2
# Install the Sitecore Install Framwork module
Install-Module SitecoreInstallFramework
# Install the Sitecore Fundamentals module (provides additional functionality for local installations like creating self-signed certificates)
Install-Module SitecoreFundamentals
# Import the modules into your current PowerShell context (if necessary)
@fluxdigital
fluxdigital / Install-Sitecore9
Last active January 12, 2018 01:18
Install Sitecore 9 Update 1
#define parameters
$prefix = "sc91"
$PSScriptRoot = “C:\Sitecore9-Install\resources”
$XConnectCollectionService = "$prefix.xconnect"
$sitecoreSiteName = "$prefix.local"
$SolrUrl = "https://solr-sc9:8983/solr"
$SolrRoot = "C:\Solr\solr-6.6.2"
$SolrService = "Solr-6.6.2"
$SqlServer = "./"
$SqlAdminUser = "sa"
@fluxdigital
fluxdigital / BaseExternalMultiList.cs
Created May 10, 2018 00:08
A Base Class for a MultiList with External an Datasource
namespace FluxDigital.Sitecore.Extensions.Fields
{
public abstract class BaseExternalMultiList : MultilistEx
{
private string _itemCountsjs = "";
/// <summary>
/// Return here your unselected items. First value is the ID you will store into your field, the second one is the display text.
/// </summary>
/// <returns>The unselected items</returns>
@fluxdigital
fluxdigital / CryptoMultilist.cs
Created May 10, 2018 00:17
An example Sitecore Multilist with an external datasource
namespace FluxDigital.Sitecore.Extensions.Fields
{
public class CryptoMultilist : BaseExternalMultiList
{
private List<CryptoCoin> _coinList;
protected override void InitRendering()
{
CryptoService cryptoService = new CryptoService();
_coinList = cryptoService.CointList();
@fluxdigital
fluxdigital / CryptoService.cs
Created May 10, 2018 00:25
An Example Crypto API Service to use as an external Datasource
namespace FluxDigital.Sitecore.Extensions.Services
{
public class CryptoService
{
public List<CryptoCoin> CointList()
{
List<CryptoCoin> coinList = new List<CryptoCoin>();
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("https://www.cryptocompare.com/api/data/coinlist/");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "GET";
@fluxdigital
fluxdigital / RootCryptoResponse.cs
Created May 10, 2018 00:32
The root response Item from the www.cryptocompare.com API
namespace FluxDigital.Sitecore.Extensions.Models
{
public class RootCryptoResponse
{
public string Response { get; set; }
public string Message { get; set; }
public string BaseImageUrl { get; set; }
public string BaseLinkUrl { get; set; }
[JsonProperty("Data")]
@fluxdigital
fluxdigital / CryptoCoin.cs
Created May 10, 2018 00:34
Model for the CryptoCoin Json Response
namespace FluxDigital.Sitecore.Extensions.Models
{
public class CryptoCoin
{
public string Id { get; set; }
public string CoinName { get; set; }
public string Name { get; set; }
public string FullName { get; set; }
public string Symbol { get; set; }
public string Url { get; set; }
@fluxdigital
fluxdigital / Update-Package-Optomisation-Settings
Last active August 23, 2018 08:57
Sitecore Settings when installing and update package
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<contentSearch>
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
<indexes hint="list:AddIndex">
<!--add other indexes to disable here-->
<index id="sitecore_core_index">
<strategies hint="list:AddStrategy">
<strategy set:ref="contentSearch/indexConfigurations/indexUpdateStrategies/manual" />
</strategies>
@fluxdigital
fluxdigital / Change-Template.ps1
Last active October 30, 2018 18:23
SPE function to update the data template of an item (and optionally it's child items) from one template to another
<#
.SYNOPSIS
Updates the data template of an item (and optionally it's child items) from one template to another
.PARAMETER RootItemId
Specifies an Item Id to start searching for items from
.PARAMETER SourceTemplateId
Specifies the Id of the template to match items on (the template you wish to change)
.PARAMETER TargetTemplateId
Specifies the Id of the template to change items to
.PARAMETER Recurse
@fluxdigital
fluxdigital / BlogPostListController
Last active November 17, 2018 17:11
List Telligent Community Blog Posts in Sitecore from SDK
using TcDemo.Models.TcBlogPost;
public class BlogPostListController : Controller
{
public ActionResult Index()
{
var host = new TelligentRestHost("http://tcdemo.local.com", "testuser", "5h4qg4basasgssdpglyt5sjtkw44u3", false, 10, null);
restGetOptions = new RestGetOptions()
{
QueryStringParameters =
{