4

While working on an environment upgrade, we stumbled upon a weird publishing error which told us some schema had a wrong namespace uri. We got an error

'RenderComponentPresentation()' had error 'Unexpected namespace URI: xyz. Expecting: abc.'

Unfortunately, from the error or the logging, we couldn't really find out which schema was causing the problem.

Is there a way to, just using the namespace url, find the schema ?

7

We were able to find the schema that caused issues by using the powershell modules provided by Peter Kjaer (https://github.com/pkjaer/tridion-powershell-modules).

With this module, we were able to write and execute the following command (the function was also provided by Peter in one of the samples)

function Get-TridionChildItem([string]$Id, [int[]]$ItemType, [switch]$Recursive, [switch]$ExpandProperties)
{
       $client = Get-TridionCoreServiceClient;
       $filter = new-object Tridion.ContentManager.CoreService.Client.OrganizationalItemItemsFilterData;
       $filter.ItemTypes = $itemType;
       $filter.Recursive = $Recursive;

       if ($ExpandProperties)
       {
              return $client.GetList($id, $filter) | Get-TridionItem;
       }
       else 
       {
              return $client.GetList($id, $filter);    
       }
       $client.Close();
}
Get-TridionChildItem -Id 'tcm:1-1-2' -ItemType 8 -Recursive -ExpandProperties | Where-Object {$_.NamespaceUri -eq "xyz"} 

As a result, we received all information of the schemas we were looking for. The same code could be used to quickly search for something based on one of the item's properties

6

The Core Service has a method called GetSchemasByNamespace, which returns all Schemas with a given Namespace URI (and optionally a Root Element Name).

  • that's interesting, That option would work as well. Didn't know about this function, thanks for letting me know – Harald Hoffelinck Jul 27 '18 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.