Error “Unable to open Lookup list” con columnas de taxonomía

Las columnas de taxonomía utilizan por debajo una referencia a la lista “TaxonomyHiddenList”. Durante una migración o una restauración de contenido podemos perder esta referencia provocando un error general al visualizar la columna o intentar utilizarla desde cualquiera de las vistas de una lista o biblioteca, encontrado en el log entradas del tipo:

System.Runtime.InteropServices.COMException: Esta lista no existe.  La página seleccionada contiene una lista que no existe. Es posible que otro usuario la haya eliminado.

Error while executing web part: Microsoft.SharePoint.SPException: Esta lista no existe.  La página seleccionada contiene una lista que no existe. Es posible que otro usuario la haya eliminado.

Si analizamos los logs por encima de estos errores encontraremos una traza con el ID de la lista utilizada:

Unable to open Lookup list ‘{60ef64a9-fc75-47c0-b2cf-f2b59001eea3}’.[Error was 0x81020026]

 

Para solucionar el problema debemos actualizar el esquema de la columna de taxonomía con el ID de la lista TaxonomyHiddenList y el ID del sitio raíz adecuados. El esquema de una columna lo encontraremos en la propiedad “SchemaXml” aunque si trabajamos con columnas localizadas utilizaremos la propiedad “SchemaXmlWithResourceTokens”.

Comparto con vosotros un script con el que podréis actualizar las referencias de cualquier columna de taxonomía https://gallery.technet.microsoft.com/Unable-to-open-lookup-list-e0c59b0b

if ((Get-PSSnapin «Microsoft.SharePoint.PowerShell» -ErrorAction SilentlyContinue) -eq $null) {

    Add-PsSnapin Microsoft.SharePoint.PowerShell

}

 

 

function Fix-UnableToOpenLookupList( [Parameter(Mandatory=$true)][string] $siteCollectionURL, [Parameter(Mandatory=$true)][string] $internalFieldName)

{

    $site = get-spsite $siteCollectionURL

    $web = $site.RootWeb

 

    $field = $web.Fields.GetFieldByInternalName($internalFieldName)

    if($field -eq $null)

    {

        Write-Host -ForegroundColor Red «ERROR: Missing $($internalFieldName) column.»

    }

    else

    {

        $txHiddenList = $web.Lists[«TaxonomyHiddenList»]

        if($txHiddenList -eq $null)

        {

            Write-Host -ForegroundColor Red «ERROR: Missing TaxonomyHiddenList.»

        }

        else

        {

            $strXmlSchema = «<r>$($field.SchemaXmlWithResourceTokens)</r>»

            $xmlSchema = [xml]$strXmlSchema

            $xmlfield = $xmlSchema.r.SelectSingleNode(«Field»)

            $xmlfield.List = «{$($txHiddenList.ID)

            $xmlfield.WebID = «{$($web.ID)

 

            $strXmlSchema = $xmlfield.OuterXml

            $field.SchemaXml = $strXmlSchema

            $field.Update($true)

 

            Write-Host -ForegroundColor Green «Done.»

        }

    }

}

 

 

Un ejemplo de un esquema de columna de tipo Taxonomía sería el siguiente XML.

<Field Type=»TaxonomyFieldType» DisplayName=»$Resources:EPContentManagement,EstimationTypeDisplayName;»

       List=»{60ef64a9-fc75-47c0-b2cf-f2b59001eea3}»

       WebId=»3c8e614a-be52-4210-93ac-8b40d3a85227″

       ShowField=»Term$Resources:core,Language;»

       StaticName=»EstimationType»

       Group=»$Resources:EPContentManagement,EPGroupName»

       ID=»{b04c8f3f-cbbf-4fdc-b646-639377c1395a}»

       SourceID=»{5ec29463-9b4b-403d-b6c1-958d526382b7}»

       Name=»EstimationType» Mult=»FALSE» Version=»6″ Required=»FALSE» EnforceUniqueValues=»FALSE» ShowInEditForm=»FALSE» ColName=»int3″ RowOrdinal=»0″>

  <Default />

  <Customization>

    <ArrayOfProperty>

      <Property>

        <Name>SspId</Name>

        <Value xmlns:q1=»http://www.w3.org/2001/XMLSchema» p4:type=»q1:string» xmlns:p4=»http://www.w3.org/2001/XMLSchema-instance»>7f76724b-947d-4aaf-a042-fcbe5a247852</Value>

      </Property>

      <Property>

        <Name>GroupId</Name>

      </Property>

      <Property>

        <Name>TermSetId</Name>

        <Value xmlns:q2=»http://www.w3.org/2001/XMLSchema» p4:type=»q2:string» xmlns:p4=»http://www.w3.org/2001/XMLSchema-instance»>cf28e84e-ab80-4727-a95e-55a183a63825</Value>

      </Property>

      <Property>

        <Name>AnchorId</Name>

        <Value xmlns:q3=»http://www.w3.org/2001/XMLSchema» p4:type=»q3:string» xmlns:p4=»http://www.w3.org/2001/XMLSchema-instance»>00000000-0000-0000-0000-000000000000</Value>

      </Property>

      <Property>

        <Name>UserCreated</Name>

        <Value xmlns:q4=»http://www.w3.org/2001/XMLSchema» p4:type=»q4:boolean» xmlns:p4=»http://www.w3.org/2001/XMLSchema-instance»>false</Value>

      </Property>

      <Property>

        <Name>Open</Name>

        <Value xmlns:q5=»http://www.w3.org/2001/XMLSchema» p4:type=»q5:boolean» xmlns:p4=»http://www.w3.org/2001/XMLSchema-instance»>false</Value>

      </Property>

      <Property>

        <Name>TextField</Name>

        <Value xmlns:q6=»http://www.w3.org/2001/XMLSchema» p4:type=»q6:string» xmlns:p4=»http://www.w3.org/2001/XMLSchema-instance»>{91e2b0ab-363b-47de-9c95-5d6cdad201eb}</Value>

      </Property>

      <Property>

        <Name>IsPathRendered</Name>

        <Value xmlns:q7=»http://www.w3.org/2001/XMLSchema» p4:type=»q7:boolean» xmlns:p4=»http://www.w3.org/2001/XMLSchema-instance»>false</Value>

      </Property>

      <Property>

        <Name>IsKeyword</Name>

        <Value xmlns:q8=»http://www.w3.org/2001/XMLSchema» p4:type=»q8:boolean» xmlns:p4=»http://www.w3.org/2001/XMLSchema-instance»>false</Value>

      </Property>

      <Property>

        <Name>TargetTemplate</Name>

        <Value xmlns:q9=»http://www.w3.org/2001/XMLSchema» p4:type=»q9:string» xmlns:p4=»http://www.w3.org/2001/XMLSchema-instance» />

      </Property>

      <Property>

        <Name>CreateValuesInEditForm</Name>

        <Value xmlns:q10=»http://www.w3.org/2001/XMLSchema» p4:type=»q10:boolean» xmlns:p4=»http://www.w3.org/2001/XMLSchema-instance»>false</Value>

      </Property>

      <Property>

        <Name>FilterAssemblyStrongName</Name>

        <Value xmlns:q11=»http://www.w3.org/2001/XMLSchema» p4:type=»q11:string» xmlns:p4=»http://www.w3.org/2001/XMLSchema-instance»>Microsoft.SharePoint.Taxonomy, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Value>

      </Property>

      <Property>

        <Name>FilterClassName</Name>

        <Value xmlns:q12=»http://www.w3.org/2001/XMLSchema» p4:type=»q12:string» xmlns:p4=»http://www.w3.org/2001/XMLSchema-instance»>Microsoft.SharePoint.Taxonomy.TaxonomyField</Value>

      </Property>

      <Property>

        <Name>FilterMethodName</Name>

        <Value xmlns:q13=»http://www.w3.org/2001/XMLSchema» p4:type=»q13:string» xmlns:p4=»http://www.w3.org/2001/XMLSchema-instance»>GetFilteringHtml</Value>

      </Property>

      <Property>

        <Name>FilterJavascriptProperty</Name>

        <Value xmlns:q14=»http://www.w3.org/2001/XMLSchema» p4:type=»q14:string» xmlns:p4=»http://www.w3.org/2001/XMLSchema-instance»>FilteringJavascript</Value>

      </Property>

    </ArrayOfProperty>

  </Customization>

</Field>

 

 

Publicado por

Mario Cortés

Mario Cortés Flores es MVP en Office 365, trabaja en Plain Concepts como Team Lead y escribe habitualmente en geeks.ms/blogs/mcortes y en Twitter @mariocortesf. Podréis encontrarlo colaborando activamente con la comunidad de MadPoint y SUGES

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *