Sometimes it’s necessary to repair Lookup column in SharePoint. Usually it can happen when we need to transport a list from a Production environment to a Development environment, just to reproduce some bug or situation with real world data. This is possible when you use the Save as Template feature, exporting it from an environment to another and then you recreate the list.
But, if you have Lookup fields it can give you some headaches. As soon as the list is restored in the other environment, the Internal GUIDs will be changed forever and any connection to the source list of the lookup column will be lost!
But it’s important to emphasize that Lookup columns are great as Microsoft says that “You can create relationships between lists by using a combination of unique columns, lookup columns, and relationship enforcement (cascade and restrict delete), all of which enhance your ability to create more sophisticated business solutions and help preserve the integrity of your data.”.
Corrupted Lookup column in SharePoint
If you want to know that your column is corrupted, you can check that the option Get information from will be empty and the column name will be a span, not a a dropdown, right where you were able to select which field should be presented before:
Also, the list form will show an error message: One or more fields are not installed properly. Go to the list settings page to delete these fields.
How to repair the column
You must run the PowerShell below and fill the parameters. We need the the List Names and Column Names used in your new environment. It will get the required information and fix the relationship:
I hope this snippet can help you on your task to repair Lookup column in SharePoint. So why don’t you learn how to query your now “working” list? You can check this blog post about list operations in SharePoint?
As always, thank you for reading my blog post!
References:
I Like SharePoint
Great tip. Thank you for share. 😉
You are welcome, Ananka!