Sharepoint 2010 Personalization Site and Global Navigation Audience Targeting

 Computer, Sharepoint, Software  Comments Off on Sharepoint 2010 Personalization Site and Global Navigation Audience Targeting
Jul 032012
 
Share

For whatever reason; the Global Navigation in a Personalization Site template does not support Dynamic FlyOut menus OR Audience Targeting.

I had added several custom links in my top navigation bar and audience targeted them according to specific user roles. All users, however, could
see every link regardless of the audience targeting.

Here’s my workaround.

1. In your default.master remove the globalnavigation delegate control.

<sharepoint:delegatecontrol runat="server" controlid="GlobalNavigation" />

2. Replace it with the following copy of the TopNavigationMenu

<!-- Start New Nav -->
<link rel="stylesheet" href="myDBMenu.css" type="text/css"/>
<asp:ContentPlaceHolder id="PlaceHolderHorizontalNav" runat="server">
<table style="width:100%;background-color:#24394F; border-bottom:2px black solid;">
<tr><td>
 <SharePoint:AspMenu
 ID="myDBmenu"
 Runat="server"
 DataSourceID="topSiteMap"
 EnableViewState="false"
 AccessKey="<%$Resources:wss,navigation_accesskey%>"
 Orientation="Horizontal"
 StaticDisplayLevels="2"
 MaximumDynamicDisplayLevels="1"
 DynamicHorizontalOffset="0"
 StaticPopoutImageUrl="/_layouts/images/menudark.gif"
 StaticPopoutImageTextFormatString=""
 DynamicHoverStyle-BackColor="#CBE3F0"
 SkipLinkText=""
 StaticSubMenuIndent="0"
 CssClass="myDBmenu">
 <DynamicHoverStyle CssClass="myDBmenuFlyOutsHover" />
 <DynamicMenuItemStyle CssClass="myDBmenuFlyOuts" />
 <DynamicMenuStyle CssClass="myDBmenuDynamo" />
 <StaticHoverStyle CssClass="myDBmenuHover" />
 </SharePoint:AspMenu>
 <SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate">
 <Template_Controls>
 <asp:SiteMapDataSource
 ShowStartingNode="False"
 SiteMapProvider="SPNavigationProvider"
 id="topSiteMap"
 runat="server"
 StartingNodeUrl="sid:1002"/>
 </Template_Controls>
 </SharePoint:DelegateControl>
 </td></tr>
 </table>
 </asp:ContentPlaceHolder>

3. I am also using my own Style sheet; that for your reference is below.

.myDBmenu
{
 background-color:#24394F;
 font-size:10pt;
 padding:5px;
 font: #FFF;
  color:#FFF;
}
 .myDBmenu A:Visited
{
 color: #FFF;
}
  .myDBmenu td
{
 padding-right:5px;
 text-align:center;
}
.myDBmenuHover
{
}
.myDBmenuDynamo
{
 background-color: silver;
 border:thin black solid;
 width:15%;
 }
 .myDBmenuFlyOuts table
{
 width:15%;
 background-color:gray;
}
 .myDBmenuFlyOutsHover
{
 width:15%;
 background-color:gray;
}