Friday, October 21, 2011

"SharePoint 2007 to 2010 Upgrade" online project (part 7) : In-place upgrade BDC failed: the bdc service application is not accessible There are no addresses available for this application

[What you have]:
 An Upgraded 2007 farm by means in-place upgrade model ("SharePoint 2007 to 2010 Upgrade" online project (part 3): "Theory"). After you have upgraded the farm, you have
[name of your 2007 SharedServices] - Business Data Connectivity Service where all converted BDC files reside.  On click on that service you are getting the error: 
the bdc service application is not accessible. There are no addresses available for this application

[What you want]:
Fix the error and use the the converted BDC files.

[What you want to know]: 

You may first try to google the error itself. My google findings couldn't  fix the errors. And I ended up removing the broken BDC service. But before removing I exported all converted BDCM files. This post is all about How to export BDCM out of the broken BDCS.
(Btw, still confused with BDC and similar abbreviation? - welcome to read post on SharePoint 2010: BCS and BDC)

[What you want to do]:
Firstly, try to export BDCM using SPD 2010. My attempt has failed. And I happily returned to PowerShell to get my BDCM files out of the Business Connectivity Service 
(Want a quick intro into PowerShell and SharePoint - PowerShell and SharePoint: What, Why and How)


Here is the code to export BDC models:


$models=@(
#array of your model names
);
foreach ($modelName in $models)
{
$path =  "G:\temp\LOCAL\BDCM\{0}.bdcm" -f $modelName;
$Model = Get-SPBusinessDataCatalogMetadataObject -BdcObjectType "Model" -name $modelName -ServiceContext {your web application URL}
if ($Model -ne $null)
{
Export-SPBusinessDataCatalogModel -Identity $Model -Path $path -force
Write-Host "The model $modelName has been exported";
}
}