One of our environments is one that was upgraded from MOSS 2007. In that transition, BDC changed to BCS and we didn’t really take care of that because we weren’t using BDC that much. One of the lists got migrated and stopped working, but because it was in a dark alley on our SharePoint site, no one really noticed. Untill last week, when one of our users tried to use it to discover all he was getting was errors. Hmmmm.
So I checked the ULS logs and noticed these kinds of errors:
System.ArgumentException: Parameter name: combinedEncoded at Microsoft.SharePoint.BdcClientUtil.SplitStrings(String combinedEncoded)
Okay. Not real usefull as usual. But the mentioning of “BdcClientUtil” triggered me to check out the list columns. And ideed: one of those was an external column, most likely causing the problems. Because of the way our BCS layer changed, I knew there was no way I was going to be able to restore the data in a proper way. So I suggested to the user we’d delete the column alltogether and replace it by a new, working one. He agreed, great.
But deleting the column also failed with the same error. Probably the SharePoint logic handling the column in basis was failing. Tried again from Powershell; same shit. Crap, now what?
So I took some steps which eventually made it so that I could delete the column, the related colums and fix the list. I must admit that I don’t know for sure if all the steps are nescessary, but to be complete I’ll mention them all. Disclaimer: I don’t know the effects on the long term, but our list seems to be in good shape again. You will use the information from this column though, that much is sure.
- First make sure your views don’t contain any BDC (External data) or related columns any longer.
- Now create a new text based column, call it TEMP or something, name doesn’t really matter. It’s only the definition that matters.
- Get a reference to your new TEMP field in Powershell, like this:$web = Get-SPWeb http://sharepoint/web
$list = $web.Lists[“Listname”]
$field = $list.Fields[“TEMP”]
- View the definition of the SchemaXml property of the field and copy it to notepad for usage later on.
- Delete your TEMP column:
- Now get a reference to your offending field, same as above but with the correct fieldname.
- Again, check SchemaXml. There are two attributes of importance; RelatedField and SecondaryFieldWssNames. The first is a hidden field in which the ID of the entity is stored, the second contains a list of related fields when used. You will need these because you need to manually delete those too; note them.
- Now replace the SchemaXml contents with the one of the TEMP field we created earlier. This will make SharePoint forget that this is a BCS column. Don’t forget to run $field.Update() after setting the value, otherwise it’s not stored.
- Now that your field is detached, you should have little problems deleting it. For the related fields; you each need to delete them seperately. For some columns, this will throw errors because deleting is prohibited because they’re marked as Hidden or ReadOnly. You can get around this with these property settings:$field.Hidden = $false
$field.ReadOnlyField = $false
$field.AllowDeletion = $true
For some reason I still needed to recreate one of my views. Probably a BDC bit that got stuck there, not sure. But after recreating, all was well.
That’s it. Powershell to the rescue once again!