Created
March 20, 2014 13:47
-
-
Save willprice76/9664092 to your computer and use it in GitHub Desktop.
Clear all items from a publish transaction for a certain publication. This can be used to implement publish in child publications functionality without publishing content in the parent (master) publication. See https://gist.github.com/willprice76/9639405 for a start point, you will want to put a check to see if the status is Success before delet…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using Tridion.ContentManager; | |
using Tridion.ContentManager.Publishing; | |
using Tridion.ContentManager.Publishing.Resolving; | |
namespace Example.Resolvers | |
{ | |
/// <summary> | |
/// Example resolver to clear all items from publish transactions in certain publications. This can be used as is, or in combination with the | |
/// event system, to remove these empty transactions from the publish queue | |
/// </summary> | |
public class ExampleResolver | |
{ | |
public void Resolve(IdentifiableObject item, ResolveInstruction instruction, PublishContext context, global::Tridion.Collections.ISet<ResolvedItem> resolvedItems) | |
{ | |
var noPublishConfig = new List<int> { 18, 20 };//Load your master publication ids in from config however you like | |
if (noPublishConfig != null & noPublishConfig.Contains(context.Publication.Id.ItemId)) | |
{ | |
resolvedItems.Clear(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment