Skip to content

Instantly share code, notes, and snippets.

View harshbaid's full-sized avatar

Harsh Baid harshbaid

View GitHub Profile
@harshbaid
harshbaid / SelectRendering.xml
Created June 22, 2017 19:53 — forked from jammykam/SelectRendering.xml
Updated Sitecore Tabbed Select Rendering Dialog
<?xml version="1.0" encoding="utf-8" ?>
<control xmlns:def="Definition" xmlns="http://schemas.sitecore.net/Visual-Studio-Intellisense">
<Sitecore.Shell.Applications.Dialogs.SelectRendering>
<FormDialog ID="Dialog" Icon="Core/32x32/open_document.png" Header="Open Item"
Text="Select the item that you wish to open. Then click the Open button." OKButton="Open">
<Stylesheet Src="SelectItemWithThumbnails.css" DeviceDependant="true" />
<CodeBeside Type="MyProject.Custom.Dialogs.SelectRenderingTabbed.SelectRenderingForm, MyProject.Custom"/>
<DataContext ID="DataContext" Root="/"/>
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
@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>
@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 / 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 / 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 / .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 / 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>
$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 / 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)"