Skip to content

Instantly share code, notes, and snippets.

View peplau's full-sized avatar

Rodrigo Peplau peplau

View GitHub Profile
@peplau
peplau / Configure_RenderingHost_Locally.ps1
Last active September 9, 2023 17:06
XM Cloud local development cheat sheet
# 1. Select the Rendering Host at /sitecore/system/Settings/Services/Rendering Hosts
# 2. Create new Rendering Host eg: "Local"
# 3. Edit the Local item:
# - Server side rendering engine endpoint URL: http://rendering:3000/api/editing/render
# - Server side rendering engine application URL: http://rendering:3000
# 4. Select Site Grouping definition under YourSite/Settings/Site Grouping
# - Predefined application rendering host field: Select Local
@peplau
peplau / ParseCsv.cs
Last active December 28, 2022 22:33
(C# code) Parse CSV into memory as a List of Dynamic Objects, with properties named accordingly to the CSV header. This code uses Sitecore Powershell Extensions to run a PS command that does the translation to Dynamic Objects.
using Spe.Core.Host;
using System.Reflection;
/// <summary>
/// Load CSV string to memory as array of dynamic objects
/// </summary>
/// <param name="csvContent"></param>
/// <returns>Array of dynamic objects</returns>
public dynamic ParseCsv(string csvContent) {
using (var scriptSession = ScriptSessionManager.NewSession("Default",true)) {
@peplau
peplau / Add Item to Package Advanced
Last active July 11, 2023 14:40
SPE: Advanced Packaging Features
# /sitecore/system/Modules/PowerShell/Script Library/SPE/Tools/Package Generator/Content Editor/Context Menu/Packaging/Add Item to Package Advanced
$selectedItem = Get-Item -Path .
$includeLinkedItems = 0
$parameters = @(
@{ Name = "Mode"; Title="Installation Options"; Value = "Merge-Merge"; Options = $installOptions; OptionTooltips = $installOptionsTooltips; Tooltip = "Hover over each option to view a short description."; Hint = "How should the installer behave if the package contains items that already exist?<br/><br/>Item : $($selectedItem.ProviderPath)"; Editor="combo"})
#if($selectedItem.ItemPath.StartsWith("/sitecore/content")) {
#$parameters += @{ Name = "IncludeLinkedItems"; Title = "Include Linked Items"; Hint = "Choose one or more options below to include items linked. This relies on the Link Database to determine references."; Options = $linkedItemOptions; OptionTooltips = $linkedItemOptionTooltips; Editor = "checkbox" }
$parameters += @{ Name = "IncludeLinkOptions"; Title = "Include
@peplau
peplau / SPE: Quick Download Tree as Package (Advanced)
Last active November 10, 2022 20:39
SPE: Advanced Quick Download Tree as Package - Allows the user to pick and choose among Linked Items to include in the package as well
Line 1 - Changed the Import-Function Name to Setup-PackageGeneratorAdvanced
Line 5 - Removed as the $path variable was not used
Lines 20-22 - Updated to always show the Links tab, which is now a radiobox
Line 74 - Replaced by the block from lines 75 to 149
Lines 76 to 87 - Replaced by the block from lines 151 to 162
@peplau
peplau / Update-PackagesFile.ps1
Last active November 2, 2021 01:43
Updates a packages.config file into your desired version of Sitecore to help automatize upgrades with the aid of the CSV provided by Jan Bluemink: http://www.stockpick.nl/english/sitecore-nuget-dependencies-in-sitecore-101/
<#
.Synopsis
Provides NuGet commands to updates a packages.config file into your desired version of Sitecore to help automatize upgrades
with the aid of the CSV provided by Jan Bluemink: http://www.stockpick.nl/english/sitecore-nuget-dependencies-in-sitecore-101/
.Description
The script uses a CSV file to scan the existing packages.config file and generate NuGet commands to update the project
.Example
.\Update-PackagesFile.ps1 -Csv "C:\temp\NuGet Sitecore.Platform.Assemblies 10.1.0 rev. 005207.csv" -Packages "D:\Git\myproject\packages.config" -ProjectName "Altudo.SitecoreMarketingAutomation.Connector.Common"
#>
[CmdletBinding(DefaultParameterSetName = "None", SupportsShouldProcess = $true)]
Get-Childitem cert:\LocalMachine\root -Recurse | Where-Object {$_.Issuer -ne $_.Subject}
If the above brings entries, we need to remove them with:
Get-Childitem cert:\LocalMachine\root -Recurse | Where-Object {$_.Issuer -ne $_.Subject} | Move-Item -Destination Cert:\LocalMachine\CA
Source: https://getfishtank.ca/blog/sitecore-9-xconnect-status-403-forbidden-certificate-error
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
Register-PSRepository -Default -Verbose
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
procdump -ma 3360 -c 80 -a -r
@peplau
peplau / Create new XConnect client SSL certificate.ps1
Last active January 12, 2021 17:42
Create new XConnect client SSL certificate
#define parameters
$prefix = "DevAspenDentalSitecore"
$PSScriptRoot = "D:\Upgrade\Sitecore 10.0.0 rev. 004346 (WDP XP0 packages)\XP0 Configuration files 10.0.0 rev. 004346"
#install client certificate for xconnect
$certParams = @{
Path = "$PSScriptRoot\createcert.json"
CertificateName = "$prefix.xconnect_client"
ExportPassword = "Test123!"
}
Update-Package <package_name> -ProjectName MyProject -reinstall
Eg: Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -ProjectName YourCLient.YourProject -reinstall