Showing posts with label Navigation Sharepoint. Show all posts
Showing posts with label Navigation Sharepoint. Show all posts

Wednesday, July 13, 2016

How to get friendly URL of the current page in Sharepoint

string url = HttpContext.Current.Request.Uri.OriginalString;
TaxonomyNavigationContext class ontains several properties which will help you to work with friendly URLs programmatically,
For Example:
 HasFriendlyUrl and ResolvedDisplayUrl (all properties can be found here).
you can get friendly URL using the following code:

  string url = "";
if (TaxonomyNavigationContext.Current != null &&
     TaxonomyNavigationContext.Current.HasFriendlyUrl)
 {
     url = SPUtility.GetFullUrl(SPContext.Current.Site,
          TaxonomyNavigationContext.Current.ResolvedDisplayUrl);
  }

Wednesday, December 9, 2015

Programmatically Create SharePoint Toplink bar and Quicklaunch bar in SharePoint 2010 and 2013

Programmatically Create TopLink Bar in SharePoint site collection:

SPNavigationNodeCollection topnav = oweb.Navigation.TopNavigationBar;
SPNavigationNode node = new SPNavigationNode("Title", "URL");
node = topnav.AddAsLast(node);
node.Update();


Similarly, To create Quicklaunch bar

SPNavigationNodeCollection topnav = oweb.Navigation.QuickLaunch;
SPNavigationNode node = new SPNavigationNode("Title", "URL");
node = topnav.AddAsLast(node);
node.Update();