Article ID: 983018 - View products that this article applies to.
Consider the following scenario:
You have a server that is running Microsoft SharePoint Server 2010 with Enterprise Client Access License (CAL) enabled. You use the following Windows PowerShell cmdlet to fetch the Web Services Description Language (WSDL) Business Data Catalog of the line-of-business (LOB) system:
Import-SPBusinessDataCatalogModelIn this scenario, you receive the following error message:
Import-SPBusinessDataCatalogModel : Proxy creation failed. Default context not found.
Error was encountered at or just before Line: 'line#' and Position: 'position#'.
At line:line# char:char#
+ Import-SPBusinessDataCatalogModel <<<< -Identity $catalog -Path path_to_catalog\linkus.bdcm
+ CategoryInfo : InvalidData: (Microsoft.Share...alogModelCmdlet: SPImportSPBusinessDataCatalogModelCmdlet) [Import-SPBusinessDataCatalogModel], PackageFormatException
+ FullyQualifiedErrorId : Microsoft.SharePoint.BusinessData.SharedService.SPImportSPBusinessDataCatalogModelCmdlet
This issue occurs when the ServiceContext scope is not defined before you try to import the WSDL Business Data Catalog.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
To work around this issue, you must define the ServiceContext scope before you try to use the Import-SPBusinessDataCatalogModel Windows PowerShell cmdlet. The following is an example Windows PowerShell script that implements this workaround:
To programmatically set the scope, you must use the following declarations:
When the code finishes the import, you must dispose the scope as follows:
For more information about how to set the scope for Business Data Catalog imports, visit the following SharePoint blog page:
SharePoint+PowerShell is (Usually) a Perfect Match
Article ID: 983018 - Last Review: April 9, 2011 - Revision: 2.0