Skip to content

Instantly share code, notes, and snippets.

View marcduiker's full-sized avatar
/-/

Marc Duiker marcduiker

/-/
View GitHub Profile
using System.Collections.Generic;
using System.Linq;
using Sitecore.Data;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using SitecorePlayground.Common.Interfaces.Adapters;
namespace SitecorePlayground.Common.Adapters
using Sitecore.Data;
using Sitecore.Data.Items;
using SitecorePlayground.Common.Adapters;
using SitecorePlayground.Common.Interfaces.Adapters;
using SitecorePlayground.Common.Interfaces.Providers;
namespace SitecorePlayground.Common.Providers
{
public class ItemProvider : IItemProvider
{
using Sitecore.Data;
using SitecorePlayground.Common.Interfaces.Adapters;
using SitecorePlayground.Common.Interfaces.Providers;
using SitecorePlayground.News.Models;
namespace SitecorePlayground.News.Providers
{
public class AuthorProviderBasedOnItemAdapter
{
using System;
using Moq;
using NUnit.Framework;
using Sitecore.Data;
using SitecorePlayground.Common.Interfaces.Adapters;
using SitecorePlayground.Common.Interfaces.Providers;
@marcduiker
marcduiker / extensionmethod.snippet.xml
Created October 5, 2015 13:33
Visual Studio code snippet to create an extension method.
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
<Title>Extension Method</Title>
<Author>Marc Duiker</Author>
<Description>Snippet to create an extension method.
<#
This function uploads & installs the specified Sitecore update package to the given $SiteUrl.
It uses cURL (http://curl.haxx.se/) to post a request to a Sitecore website which has Sitecore Ship installed.
Example usage:
.\deploy-sitecorepackage.ps1 mysite.dev "C:\Project\Build\Artifacts\1-mysite-templates.update" 60 300
#>
Param(
[Parameter(Position=0, Mandatory=$true)]
<#
This script returns the full path of the curl.exe.
#>
$curlExe = 'curl.exe'
$curlPath = Resolve-Path "$PSScriptRoot\..\tools\curl-7.33.0-win64-nossl\$curlExe" # This is the path on the local dev machine.
if (-not (Test-Path $curlPath))
{
# Fall-back to use curl.exe located in the same location as the script.
if (Test-Path "$PSScriptRoot\$curlExe")
@marcduiker
marcduiker / Sitecore.Buckets.config.xml
Created April 28, 2016 19:56
Partial configuration that takes care of removing empty bucket folders in Sitecore.
<!-- EMPTY BUCKET CLEANING JOB
This job runs at the set interval time and removes item bucket folders that no longer contain any items.
This could be cause by deleting an item from a bucket, which has no other items in it.
-->
<scheduling>
<frequency>00:00:05</frequency>
<!-- Adjust the interval and frequency as needed to speed things up on a local dev environment. -->
<agent type="Sitecore.Buckets.Tasks.RemoveEmptyBucketFolders" method="Run" interval="00:00:10">
<DatabaseName>master</DatabaseName>
</agent>
@marcduiker
marcduiker / Update workflow and state on content items.ps1
Created May 5, 2016 23:58
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).
@marcduiker
marcduiker / Update workflow and state of content items.ps1
Last active June 5, 2021 13:09
Sitecore PowerShell script that creates a report listing content items which has no workflow set while their templates have the Default workflow field set.
<#
.SYNOPSIS
Update Workflow and Workflow state of content items which have no workflow set while their templates have the Default workflow field set.
.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).