How to publish to delete items in Sitecore

Stelio made a post on how to handle the deletion of items across Sitecore databases. And I remembered that I wrote code for this situation in another way.

The way that I’ve approached this is to extend the Item Delete event so I can publish deleted item by publishing the parent item.

Basically, I detect the parent of the item that is currently deleted by an editor, and I publish that parent item on each target database that we have on our Sitecore installation.

The code, with comments for this here:

And the config changes needed:

Sitecore Symposium 2018 highlights

Hi there,

One month from Sitecore Symposium 2018 has passed already, and I said that I should write a 1 month highlights post. That also for the fact that I’ve traveled a bit in the past month, and had to catch up a bit with all the articles/post about the Symposium.

So this is yet another post about the Sitecore Symposium 2018, the conference that was held in Orlando, USA. This is my 4th Symposium that I participated, and in fact I have participated the first one too that was held in Copenhagen, Denmark in 2010.

The conference was a really great experience for me.

George has a post on his blog about Symposium 2018 roundup links in here.

Also Jeff, made a post where he gather session recordings and slides.

But in fact, in the meanwhile Sitecore published all sessions in here here, so if participated to the conference you have access to download them. To help, Bas made a script to download all presentations at once. And I made an adjustment so that the files are saved on the disk using the original filename, not an id. Script is here.

Here is a collection on blogs posts, articles, sessions, repos that I found in the past month about Sitecore Symposium 2018.

I’ve tried to group them a bit, so here you go.

Recap, articles about the conference itself:

Posts specifically about Sitecore 9.1 that was announced at the conference.

Sessions slides/articles, repos:

I know that are quite few articles, and I hope you find them interesting, at least some of them.

I will let you with this An amazing thing happened at Symposium.

I become Sitecore 9 certified at Sitecore MVP Summit 2018

Hi there,

Well, I was a bit stressed about this certification. I have not worked that much in Sitecore lately and I did not really prepared for this exam. I participated at Sitecore MVP Summit 2018 and up until the evening before the day the exam was scheduled I was not 100% that I really want to take the exam, but made my mind and in the morning at 8:00 I was present in the room to take the exam, even that I was bit tired.

After signing up at the location – took a bit to do it – the exam started. There were 50 questions, with a countdown of 1h and 30 minutes, but apparently the room was booked for something else at 09:00, so I had a bit more than 1 minute for each question. That went quite well and I’ve passed the exam and now I am a Sitecore® 9.0 Certified Platform Associate Developer.

A study guide for the exam can be found here: https://sitecore.freshdesk.com/support/solutions/articles/16000067853-sitecore-certified-platform-associate-developer-exam-study-guide-

Sitecore-cert-details.jpg

 

Do not change global.asax in Sitecore 9!

This is a rule of thumb in Sitecore 9: Do not change global.asax. There are other ways to run a piece of code at the start of the Sitecore 9.

Until now I have used 2 ways in Sitecore 9 to run a piece of code at the start of the solution. In similar manner you can do it in Sitecore 8 as well.

#1 Using Sitecore Owin middleware.

With release of Sitecore 9, Sitecore decided to embed a OWIN module and with that there are a couple of pipelines that can be used.

What’s OWIN Middleware?

It stands for Open Web Interface for .Net. It is a new standardized interface between web servers and applications. It stands as a middleware to be used in a pipeline to handle requests and associated responses. OWIN provides a decoupling layer that allows two frameworks with disparate object models to be used together.

Sitecore 9 has implemented the OWIN Pipeline directly into the core platform and with that we can integrate external identity provider logins and no only.

You can initialize the OWIN configuration like this:

And the code:

A good usage example is implemented in the module Sitecore SignalR.

Then Sitecore already implemented Federation Authentication in Sitecore 9 using OWIN middleware and you can extend it for your needs. Bas wrote first article on how to Enable federated authentication and configure Auth0 as an identity provider in Sitecore 9.0.

Also, you can write your own implementation using OWIN, but will give you a proper example in my next article that is touching this topic and how to have custom authentication for your Sitecore Web Api.

In Sitecore 8 you can use module Sitecore-Owin to add OWIN support to your solution. Works quite well, as I have already used it to customize the Sitecore SignalR module.

#2 Using Initialize Pipeline in Sitecore.

This functionality was also available in Sitecore 8, in case you were not aware of that. This is used to start some functionality at Sitecore application start-up.

In a clean web application it possible to use global.asax, but Sitecore decided some time ago (not sure with what version exactly) to make globas.asax private. Instead you need to use the initialize pipeline. The initialize pipeline is started at the application start. Initialize pipeline is defined in Sitecore.config.
In order to use initialize pipeline it’s needed to created a new include config file with the new processor.

And the code:

Anders Laub  also has an article about this subject on this blog article Global.asax events and Sitecore pipelines.

One thing that this initialize pipeline can be used is to implement dependency injection into your solution One way to implement Dependency Injection for Sitecore Habitat.

Or you can with this functionality to register a Web Api Route using RouteTable from System.Web.Routing. Sitecore Habitat is using this functionality to register the routes like in this example:

Hope all this information is going to help you into your implementations.

How to Sitecore 9 uninstall – my take

I have installed Sitecore 9 on a machine, but I needed also to clean up at one point.

There are already a couple of articles/references about this subject:

But I’ve decided to use Rob’s uninstall scripts referenced here in his introductory article about SIF-less, but in case you want to do it in a manual way, I wrote some steps below.

But also this process requires some extra assistance/adjustments as I am having the necessary SQL server installed on a different machine.

Before running the scripts that was generated by SIF-less, make sure to install SQL Server PowerShell Module by opening PowerShell as administrator by running this command:

Install-Module -Name SqlServer -AllowClobber

For more information look at this page that has the official documentation for installing the SQL Server PowerShell module.

Then copy the remove json files from the folder Scripts that comes with the the SIF-less archive into the folder for your XP0 Configuration files, defined by $PSScriptRoot in the install script and then copy the Invoke psm1 files from the folder Scripts that comes with the the SIF-less archive into the folder that has your uninstall script.

Extra: if Sitecore 9 was installed using a different folder than the default one, using instructions from here, then the removal scripts remove-sitecore-XP0.json or remove-xconnect-xp0.json have to be modified too, in similar way.

Manual way to uninstall an instance of Siteocre 9 involves few steps, but it is not that bad. Assuming that your installation instance is prefixed with xp0Demo then:

  • Remove the two xConnect windows services (with sc.exe delete [servicename] in poweshell as administrator or in cmd.exe as administrator too)
    • xp0Demo.xconnect-MarketingAutomationService
    • xp0Demo.xconnect-IndexWorker
  • Remove the Sitecore and xConnect website and application pools from IIS
  • Remove the Sitecore and xConnect webroots
  • Remove the databases from SQL Server prefixed with xp0Demo
  • Stop the Sorl service and remove the indexes prefiex with xp0Demo from folder c:\solr\solr-6.6.2\server\solr\. Do not forget to start the Solr service again.
  • Hosts entries that are prefixed with xp0Demo should be removed too

Also I’ve tested the procedure on a Sitecore 9 update 1 and its exactly the same, not changes required.