Skip to content

Instantly share code, notes, and snippets.

View harshbaid's full-sized avatar

Harsh Baid harshbaid

View GitHub Profile
@harshbaid
harshbaid / TempFolderBrowser.aspx
Created August 4, 2021 16:13 — forked from sincladk/TempFolderBrowser.aspx
Sitecore Temp Folder Browser
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Sitecore Temp Folder Browser</title>
<link rel="Stylesheet" type="text/css" href="/sitecore/shell/themes/standard/default/WebFramework.css" />
<link rel="Stylesheet" type="text/css" href="./default.css" />
</head>
<body>
<script runat="server">
private const string TEMP_FOLDER_PATH = @"C:\inetpub\wwwroot\Sitecore\temp\";
private const int MAX_FILE_COUNT = 10;
@harshbaid
harshbaid / sxa-regenerate-optimised-assets.ps1
Created June 1, 2021 04:14 — forked from mawiseman/sxa-regenerate-optimised-assets.ps1
Sitecore SXA regenerate optimised files
# Run this script in Sitecore Powershell Extensions
# It will delete the minifed files from master and publish the deletions to web
# Next time the site is visited they should be re-generated (if they aren't check your settings http://bit.ly/2TfrcfC)
# TODO: When publishing, there might be a better way to target folders in the media library instead of the hardcoded list
$masterItems = Get-Item -Path master: -Query "/sitecore/media library//*[@@key='optimized-min']"
$webItems = Get-Item -Path web: -Query "/sitecore/media library//*[@@key='optimized-min']"
Write-Host "Master Items: $($masterItems.length)"
$props = @{
InfoTitle = "Remove workflows"
PageSize = 10000000
}
Write-Host "Starting work in the context of the 'master' database, under /Home item."
Set-Location -Path "master:/sitecore/content/<YOURNODE>"
# Set up variables
$workflowState1 = "{13FDC8BC-60B9-44E1-ADCC-CED02E0392A9}" #ID of the workflow states. DRAFT
@harshbaid
harshbaid / XConnectService.cs
Created December 12, 2019 17:36 — forked from digitalParkour/XConnectService.cs
Sitecore XConnectService extension
namespace Sitecore.Foundation.SitecoreExtensions.Services
{
using Sitecore.Diagnostics;
using Sitecore.Foundation.DependencyInjection;
using Sitecore.XConnect;
using Sitecore.XConnect.Client;
using System;
using System.Linq;
/// <summary>
@harshbaid
harshbaid / .gitconfig
Last active October 31, 2018 15:35 — forked from DamianReeves/.gitconfig
Using Visual Studio AS Git Merge Tool
[diff]
tool = vsdiffmerge
[difftool]
prompt = true
[merge]
tool = vsdiffmerge
[mergetool]
prompt = true
[difftool "vsdiffmerge"]
cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsdiffmerge.exe\" \"$LOCAL\" \"$REMOTE\" //ignorespace //t
@harshbaid
harshbaid / FindKeywordInAllFields.ps1
Created October 3, 2018 20:56 — forked from michaellwest/FindKeywordInAllFields.ps1
Search all fields for a keyword using Sitecore PowerShell Extensions.
<#
.SYNOPSIS
Find all of the items and fields which contain a specific text.
.LINK
https://vandsh.github.io/sitecore/2018/01/27/spe-search-replace.html
#>
$rootItem = Get-Item -Path "master:/sitecore/content/Home"
$needle = "nurse"
@harshbaid
harshbaid / Update workflow and state on content items.ps1
Created October 3, 2018 20:55 — forked from marcduiker/Update workflow and state on content items.ps1
Sitecore Powershell script to update the workflow and state on content items which do not have a workflow set on them.
<#
.SYNOPSIS
Updates the Workflow and Workflow state fields of content items with the given $workflowID and $workflowStateID values.
.DESCRIPTION
This script can be used when existing content is not assigned to a workflow and workflow state while it should be.
This scenario usually occurs when a workflow is assigned to a template but there is already content created based on a previous version of that template (where the workflow was not yet assigned).
@harshbaid
harshbaid / TransferAssignedSecurityToAnotherRole.ps1
Created October 3, 2018 20:48 — forked from michaellwest/TransferAssignedSecurityToAnotherRole.ps1
Finds items with a specified user or role assigned and transfers to another role in Sitecore PowerShell Extensions.
<#
.SYNOPSIS
Find all items with the specified user or role assigned.
.DESCRIPTION
This report helps identify all of the items with a specific user or role assigned and transfers to another role.
.NOTES
Michael West
#>
@harshbaid
harshbaid / ProxyForFiddler.config
Created October 3, 2018 20:47 — forked from michaellwest/ProxyForFiddler.config
Snippet to be added in the web.config, app.config, or machine.config to redirect traffic to the Fiddler proxy.
<system.net>
<defaultProxy enabled = "true" useDefaultCredentials = "true">
<proxy autoDetect="false" bypassonlocal="false" proxyaddress="http://127.0.0.1:8888" usesystemdefault="false" />
</defaultProxy>
</system.net>
using Sitecore;
using Sitecore.Diagnostics;
using Sitecore.Resources;
using Sitecore.Web.UI;
using Telerik.Web.UI;
using Sitecore.Data.Items;
namespace RTEDropList
{
public class EditorConfiguration : Sitecore.Shell.Controls.RichTextEditor.EditorConfiguration