SharePoint: Document Information Panel fails to load when office documents are opened in a library that contains lookup columns

Overview

In SharePoint 2007/2010, if you have a document library that contains lookup columns that were programmatically created or created via a custom feature, you may run into a problem where when a user clicks on a document to open the document, the document gets opened in Office Client (MS Word or MS Excel) but the Document Information Panel (DIP) that shows the document metadata fails to load and the following error is displayed on the user’s screen:

image

DIP Error when opening a word document from a document library in SharePoint

Error Message: The Document Information Panel was unable to load. The document will continue to open . For more information, contact your system administrator.

Error Details: The form cannot be opened. To fix this problem, contact the form designer.
Form template: https://servername/sites/dip/proppanel.xsn
The following DataObject either cannot be created or cannot be initialized: list_5433DC30-D758-4B56-A4CA-9CCD98716342
Document Information Panel cannot add the following object to the DataObjects collection: list_5433DC30-D758-4B56-A4CA-9CCD98716342
list_5433DC30-D758-4B56-A4CA-9CCD98716342 could not be added to the DataObjects collection.
The following item already exists in the collection: list_5433DC30-D758-4B56-A4CA-9CCD98716342

The Cause
This problem is caused if your list contains lookup columns that were created programmatically or using custom features. If the GUIDs of the list and column being referenced are not enclosed in curly brackets “{ }“ in the schema of the columns/fields, you will have this problem when opening the documents in Office Client applications.

The Solution

There was a forum discussion on one of the MSDN forums here where someone had found the problem and posted some code to fix it. I figured the code is not the easiest to use, especially since you have to compile it to run and make some changes depending on the environment. I have created a PowerShell equivalent of the code and have modified it to make it more generic. All you need to do is change the Url to the url of the site/sub-site where the document library having the problem is located and the name of the document library (variables $siteUrl and $listName). Once you run this script against the library having the problem, you should be able to open documents from the library and have the DIP loaded without any issues.

Disclaimer: The following script is a sample only and has not been tested fully. Please test this script in a test environment before applying on a production system. Provided “as is” without warranties

Add-PSSnapin Microsoft.SharePoint.PowerShell
$siteUrl = https://servername/sites/dip
$listName = "Documents"
$web = Get-SPWeb $siteUrl
$list = $web.Lists | where {$_.Title -eq $listName}
$fields = $list.Fields | where {$_.Type -eq "Lookup"}
foreach ($field in $fields)
{
Write-Host "Fixing Field "$field.Title
#Fix the Lookup WebId first
$lookupWeb = $field.LookupWebId
$tempSchema = $field.SchemaXml
$toFind = "WebId=`"$($lookupWeb)`""
$toReplace = "WebId=`"{$($lookupWeb)}`""
$tempSchema = $tempSchema.Replace($toFind, $toReplace)
#Check if we need to fix the Lookup List Id too
if ($field.LookupList.Length -gt 0)
{
$lookupList = $field.LookupList
#Need to make sure we don't do a double fix
if ($lookupList.Contains("{") -eq $false)
{
$toFind = "List=`"$($lookupList)`""
$toReplace = "List=`"{$($lookupList)}`""
$tempSchema = $tempSchema.Replace($toFind, $toReplace)
}
}
#Schema updates complete at this point. Replace the field schema
$field.SchemaXml = $tempSchema
$field.Update()
Write-Host "Done Fixing "$field.Title
}

Hope this helps! Happy SharePointing!

Comments

  • Anonymous
    August 28, 2012
    Hi Tehnoon, We are facing same issue for document library which is having lookup field , using above script is it temprary going to fix  the lookup columns but for subsite if user creates document library using Master Doc library then again we have to run this script. Is MS is going to fix this bug in next CU ? in My SharePoint Farm June 2012 CU is applied but no luck. Please let me know Thanks for script!! Santosh Kanase

  • Anonymous
    October 28, 2012
    Very helpful Script. Thanks for the time for creating this little handy script and posted up in your blog.

  • Anonymous
    February 12, 2013
    helpful post

  • Anonymous
    May 03, 2016
    thanks that helped me!

  • Anonymous
    October 13, 2017
    Spot on! Thx for the scripts, works great.Greets,Peter