When time comes to deploy business data catalog the question regarding view profile page always arises.
The important question is - is the default view profile page location ( shared services) going to be available from Sharepoint site?
Sometimes the answer is no. In this case - the solution is - put the location which is appropriate for view profile page in ADF
Example:
<Action Position="2" IsOpenedInNewWindow="false" Url="http://site.com/pt/Application%20Pages/ViewProfile.aspx?ID={0}" Name="View Profile">
<ActionParameters>
<ActionParameter Index="0" Name="ID" />
</ActionParameters>
</Action>
Remember put <Property Name="DefaultAction" Type="System.String">View Profile</Property> under each entity that must have view profile.
Example:
<Entity Name="Entity_Name">
<Properties>
<Property Name="DefaultAction" Type="System.String">View Profile</Property>
</Properties>
The next step - to build the view profile page.
Page must contain 2 webparts : Business Data Item Builder and Business Data Item. These 2 web parts must have Consumer\Provider connection.
To easy the web part development process up - you can export web parts which were setup by default by shared services when ADF was uploaded (in case the ADF doesn't have overridden the "view profile" action)
When you have got the web part in handy among with aspx page - it's time to setup them for provisioning.
I will skip the feature creation.
The final step is - setup web part connection between Business Data Item Builder and Business Data Item
In order to do this - you have write code in FeatureActivated event:
private void AddWebPartConnection(SPLimitedWebPartManager manager, string ConsumerId, string ConsumerPointTitle, string ProviderId, string ProviderPointTitle)
{
WebPart ConsumerWP = (WebPart)manager.WebParts[ConsumerId];
WebPart ProviderWP = (WebPart)manager.WebParts[ProviderId];
ConsumerConnectionPoint ConsumerConnPoint = manager.GetConsumerConnectionPoints(ConsumerWP)[ConsumerPointTitle];
ProviderConnectionPoint ProviderConnPoint = manager.GetProviderConnectionPoints(ProviderWP)[ProviderPointTitle];
manager.SPConnectWebParts(ProviderWP, ProviderConnPoint, ConsumerWP, ConsumerConnPoint);
}
To make it clear:
Manager is file.GetLimitedWebPartManager(System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);
Where file - the View Profile aspx page.
ConsumerId and ProviderId are fetched by title:
static public string GetWebPartIdByTitle(SPLimitedWebPartManager manager, string title)
{
foreach (WebPart wp in manager.WebParts)
{
if (wp.Title==title)
return wp.ID;
}
return null;
}
Web part titles, ConsumerPointTitle, ProviderPointTitle along with view profile aspx are setup in xml file which is used by feature.
Example:
<FixupFile DataViewInZone="TRUE" DeletOnDeactivation="TRUE" RelativePath="Application Pages/View_Profile.aspx" SetupWebPartConnection="TRUE" ConsumerWebPartTitle="Profile_Details" ConsumerPointTitle="BDWP Item" ProviderWebPartTitle="Business Data Item Builder" ProviderPointTitle="BDWP Item"/>
Note: for connection between Business Data Item Builder and Business Data Item the Provider\Consumer point title is "BDWP Item"
No comments:
Post a Comment