We publish an additional page using the event system when publishing events on pages. It works well when we publish a page from CME. When we create a page using the Tridion UI, it is created and published as expected, but the event system generates an error when trying to create an object of the target type.
try { foreach (var t in e.Targets) { var targets = new List<TargetType>(); some logic targets.Add(new TargetType(t.Id, page.Session)); // error is in this line PublishInstructionBase pib = e.PublishTransactions.First().Instruction; PublishInstruction pi = new PublishInstruction(page.Session); pi.StartAt = pib.StartAt; pi.RollbackOnFailure = pib.RollbackOnFailure; PublishEngine.Publish( items, pi, targets, PublishPriority.Low ); } }
The exception we get is an InvalidURIException
Both t and sessions are definitely not empty, which we checked by writing a log there.
Please tell me that we can fix the problem?
We will be able to fix this if you work a little bit on the code creation in try catch and create the target type manually if there is an exception, because we know that the publication of the Tridion UI is published only at the beginning.
Thanks Vikas Kumar
source share