Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers 2

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();
}
share|improve this answer
add comment

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.

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

hope it helps :)

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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