1

Is it possible to deploy a BCS profile page via a WSP? Did anyone try this including settting the default action on the external content type?

All references I can find explain how to create a profile page via SharePoint Designer. I would like to have WSP package that contains the external content types and everything that is necessary for it to work, including the profile page.

1

I got my issue solved the following way:

  1. Create a profile page via SharePoint designer
  2. Save the site where it was created as site template, import the WSP into Visual Studio and move the module with the profile page to my custom SharePoint solution
  3. Powershell script to enable the BCS profile host
  4. Powershell script to create a default action for the BCS entity which points to the deployed profile page

Code snippet for the profile host

function SetBcsProfileHostUrl($siteUrl)
{
    $catalog = Get-SPBusinessDataCatalogMetadataObject -BdcObjectType "Catalog" -ServiceContext $siteUrl
    $property = $catalog.Properties | Where { $_.Name -eq "Profile_HostURL" }
    if ($property) {
        $catalog.Properties.Remove("Profile_HostURL")
    }
    $catalog.Properties.Add("Profile_HostURL", $siteUrl)
}

Code snippet for the default action

function SetBcsEntityDefaultAction($siteUrl, $entityName, $namespace, $actionUrl, $parameters)
{
    $entity = Get-SPBusinessDataCatalogMetadataObject -BdcObjectType "Entity" -Name $entityName -Namespace $namespace -ServiceContext $siteUrl
    $action = $entity.Actions | Where { $_.Name -eq "View Profile" }
    if ($action) {
        $action.Delete()
    }

    $newAction = $entity.Actions.Create("View Profile", $false, 1, $false, $siteUrl + $actionUrl, "/_layouts/1033/images/viewprof.gif")
    $index = 0
    foreach ($parameter in $parameters) {
        $newAction.ActionParameters.Create($parameter, $false, $index++) | Out-Null
    }
    $entity.DefaultAction = $newAction;
    $entity.Update();
}
0

Ok after relooking at your post Iv found the right info, it looks like its not possible afterall as the info you need for the BDC model is specific environment information that must be configured per environment.

https://stackoverflow.com/questions/5408580/how-to-deploy-sharepoint-bdc-model-package-using-vs-setup-project-or-at-all

hope it helps :)

  • Thanks for the links. But I cannot find anything that is related to my issue with the profile page. Deploying the external content type via WSP works fine for me. – Bernd Rickenberg Aug 24 '12 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.