SharePoint Events

  6/25/2013 - Webcast: ROI of Workflows in SharePoint
  6/26/2013 - Webcast: SharePoint 2013 and ECM: Document Generation & Assembly
  6/27/2013 - Webcast: SharePoint 2013 and ECM: Document Processing & Content Standardization
  6/28/2013 - Webcast: RFI and Submittal Management in SharePoint
  7/25/2013 - Webcast: AEC Document Management and Distribution in SharePoint
  8/25/2013 - Conference: SharePoint Fest 2013

 SharePoint Videos

  Why SharePoint 2013
  SharePoint 2013 and Enterprise Content Management
  SharePoint 2013 Launch
  SharePoint 2013 Migration and Governance
  SharePoint 2013 and Enterprise Content Management
  Top Benefits of SharePoint 2013
  What's New in Business Intelligence in Office and SharePoint 2013
  What's New in Search for SharePoint 2013
  SharePoint and Office 2013 Integration
  SharePoint 2013 Infrastructure Preview
  SharePoint, Lync, and, Exchange in the Cloud with Office 365
  Advanced Reporting in SharePoint with Microsoft Power View
  Managing CAD in SharePoint
  SharePoint Document Automation and E-Forms for Financial Services

 Archives

Opening SharePoint Links in a new windowUse SHIFT+ENTER to open the menu (new window).
Mail Enabled Lists vs. The Missing Windows 2008 POP3/IMAP Server Use SHIFT+ENTER to open the menu (new window).
7 Tools for SharePoint DevelopersUse SHIFT+ENTER to open the menu (new window).
Public Facing Masterpage TechniquesUse SHIFT+ENTER to open the menu (new window).
How to Quickly Deploy and Activate a Timer Service to Your Site CollectionUse SHIFT+ENTER to open the menu (new window).
Custom SharePoint Master Page Feature with WSP BuilderUse SHIFT+ENTER to open the menu (new window).
Date Math with InfoPathUse SHIFT+ENTER to open the menu (new window).
Enterprise Search Tricks and Tips Part 1Use SHIFT+ENTER to open the menu (new window).
Populating Word Documents With SharePoint Data. Try The DIP!Use SHIFT+ENTER to open the menu (new window).
Programmatic Deep Dive into Blank SharePoint Lookup ColumnsUse SHIFT+ENTER to open the menu (new window).
1 - 10 Next
Redirect SharePoint Navigation - NYC SDUG Quick Dip
By: Kathryn Birstein
NYC SharePoint Developer User Group -
www.meetup.com/nycsdug
 

Redirect SharePoint Navigation

 

The SharePoint AspMenu navigation system and the SPNavigationProvider it users is sufficient for most purposes. However, there are a couple on instances when you might want to customize it. For instance, suppose you want a menu item in your intranet that points to an internet URL? Or suppose your intranet, due to content database size restrictions (should be more than 100 gigs) you are forced to split up a single-site collection web application into two web applications, but you will want to be able to address both of them with the same base URL.

 

Originally, the internet URL was accessed from a SharePoint page with Javascript code on it. The “Show Pages” option in the “Navigation” menu (note that you get this menu only when you have the Publishing feature turned on) gave us a link in AspMenu but there was a noticeable page refresh with this solution that was deemed unacceptable. When one particularly large subsite was split off from the original intranet web application (using Metalogix Site Migration Manager, which works well for moving parts of site collections around), it was moved to a first level subsite in a separate web application on port 83. This was more of a problem than the internet URL since users would have to be able to navigate back and forth from port 80 and port 83 seamlessly.

 

The solution was remarkably easy. As you know, SharePoint:AspMenu generates table HTML markup for the for the Top Navigation Menu

 

Here’s the markup for the redirect page:

 

<table class="ms-topNavFlyOuts zz1_TopNavigationMenu_7" cellpadding="0" cellspacing="0" border="0" width="100%">

<tr>

<td style="white-space:nowrap;width:100%;"><a class="zz1_TopNavigationMenu_1 ms-topNavFlyOuts zz1_TopNavigationMenu_6" href="/power/PSSites/Pages/Redirect.aspx" style="border-style:none;font-size:1em;">WESTERN NEW YORK</a></td>

</tr>

</table>

 

And here’s the markup for the subsite that was moved to a new web application. Note that we kept the empty stub of the sub-site that was split off so that the “Show subsite” option in the Navigation menu would still generate a link for it:

<table class="ms-topNavFlyOuts zz1_TopNavigationMenu_7" cellpadding="0" cellspacing="0" border="0" width="100%">

<tr>

<td style="white-space:nowrap;width:100%;"><a class="zz1_TopNavigationMenu_1 ms-topNavFlyOuts zz1_TopNavigationMenu_6" href="/power/PSSites/SENY/500mw/Pages/500MWHome.aspx" style="border-style:none;font-size:1em;">500MW</a></td>

</tr>

</table>

 

Using the JQuery $ alias to find the anchor tags, use the “attr” method to replace the href values:

 

<asp:ContentPlaceHolder id="PlaceHolderTitleAreaClass" runat="server"/>

<script src="/Style Library/Scripts/jquery-1.3.2.min.js"></script>

 

<script language="javascript" type="text/javascript">

 

$(document).ready(function() {

 var ctrlNiagra = $("a[innerHTML*=WESTERN NEW YORK]");

 ctrlNiagra.attr("href", "http://niagraserver/niagara");

        

 var ctrl500MW = "a[innerHTML*=500MW][href*=/power/PSSites/SENY/500mw/Pages/500MWHome.aspx]");

 ctrl500MW.attr("href", " http://sharepointserver.com:83/500mw");

     

 });

 

</script>

</BODY>

</HTML>

 

Now the two websites are transparently redirected to the desired URLs but you still have the issue of how to navigate back and forth between the main web application and “500mw” on port 83. This requires a change to the “500mw” master page. Fortunately it’s easy to choose a custom master page for the site through the site settings:

 

The_SharePoint_Blog_Redirect_SharePoint_Navigation

 

The only code change required on the 500MW.master is to comment out the <asp:SiteMapPath> tag within the “PlaceHolderGlobalNavigationSiteMap” content placeholder that generates the automatic bread crumb and replace it with some HTML which creates a custom bread crumb that leads back to the main intranet website on port 80:

 

asp:ContentPlaceHolder id="PlaceHolderGlobalNavigationSiteMap" runat="server">

<span id="ctl00_GlobalNavigationSiteMap">

<span><a class="ms-sitemapdirectional" href="http://sharepointserver.com">Home</a></span><span> &gt; </span>

<span><a class="ms-sitemapdirectional" href="http://sharepointserver.com/power">Power Supply</a></span><span> &gt; </span>

<span><a class="ms-sitemapdirectional" href="http://sharepointserver.com/power/PSSites">Regions</a></span></span><span> &gt; </span>

<span><a class="ms-sitemapdirectional" href="/500MW">500MW</a></span>

 

<!--

<asp:SiteMapPath SiteMapProvider="SPSiteMapProvider" id="GlobalNavigationSiteMap" RenderCurrentNodeAsLink="true" SkipLinkText="" NodeStyle-CssClass="ms-sitemapdirectional" runat="server" __designer:Preview="&lt;span id=&quot;ctl00_GlobalNavigationSiteMap&quot;&gt;&lt;span&gt;&lt;a class=&quot;ms-sitemapdirectional&quot; href=&quot;/&quot;&gt;Home&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;" __designer:Values="&lt;P N='SiteMapProvider' T='SPSiteMapProvider' /&gt;&lt;P N='NodeStyle'&gt;&lt;P N='CssClass' T='ms-sitemapdirectional' /&gt;&lt;P N='IsEmpty' T='False' /&gt;&lt;/P&gt;&lt;P N='RenderCurrentNodeAsLink' T='True' /&gt;&lt;P N='SkipLinkText' R='-1' /&gt;&lt;P N='ControlStyle'&gt;&lt;P N='Font' ID='1' /&gt;&lt;/P&gt;&lt;P N='Font' R='1' /&gt;&lt;P N='ID' T='GlobalNavigationSiteMap' /&gt;&lt;P N='Page' ID='2' /&gt;&lt;P N='TemplateControl' ID='3' /&gt;&lt;P N='AppRelativeTemplateSourceDirectory' R='-1' /&gt;" __designer:Templates="&lt;Group Name=&quot;NodeTemplate&quot;&gt;&lt;Template Name=&quot;NodeTemplate&quot; Content=&quot;&quot; /&gt;&lt;/Group&gt;&lt;Group Name=&quot;CurrentNodeTemplate&quot;&gt;&lt;Template Name=&quot;CurrentNodeTemplate&quot; Content=&quot;&quot; /&gt;&lt;/Group&gt;&lt;Group Name=&quot;RootNodeTemplate&quot;&gt;&lt;Template Name=&quot;RootNodeTemplate&quot; Content=&quot;&quot; /&gt;&lt;/Group&gt;&lt;Group Name=&quot;PathSeparatorTemplate&quot;&gt;&lt;Template Name=&quot;PathSeparatorTemplate&quot; Content=&quot;&quot; /&gt;&lt;/Group&gt;"/>

 

 

</asp:ContentPlaceHolder>

 

Make sure to designate that the Navigation on port 83 should display only the navigation items below the site so that the top site link of Port 83 is not displayed. Then the breadcrumb will be the only way to navigate back up.

 

--By: Kathryn Birstein
NYC SharePoint Developer User Group
        

Comments

There are no comments yet for this post.
Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Your Name *


e-mail address *


Website (optional)


Comment *


Attachments

 Subscribe

  GigWerks RSS  Gig Werks Mailing List 

 Contact Us

 Connect

 Resources

  On Demand SharePoint Webcast Recordings
  Upcoming Webinars
  SharePoint Resources
  Business Intelligence Resources
  Gig Werks Website



©2009 Gig Werks. All rights reserved. Privacy Policy