NavigationTerm NavigationTerm NavigationTerm Class

Definition

Specifies navigation behavior and properties for a Term object that is used to drive the navigation and friendly URLs for a website.

public ref class NavigationTerm abstract : Microsoft::SharePoint::Publishing::Navigation::NavigationTermSetItem
[Microsoft.SharePoint.Client.ClientCallableType(ClientLibraryTargets=Microsoft.SharePoint.Client.ClientLibraryTargets.NonRESTful, FactoryType=typeof(Microsoft.SharePoint.Publishing.Internal.PublishingClientObjectFactory), ObjectIdentityPropertyName="CanonicalId", ServerTypeId="74B7367A-E303-43E8-891E-DAC764C96E53")]
public abstract class NavigationTerm : Microsoft.SharePoint.Publishing.Navigation.NavigationTermSetItem
Public MustInherit Class NavigationTerm
Inherits NavigationTermSetItem
Inheritance
Attributes
Microsoft.SharePoint.Client.ClientCallableTypeAttribute

Examples

<p>The following example demonstrates creating a sample term set and then configuring a SharePoint Server web site to use managed navigation with the sample term set.</p>
<pre><code>using System;

using Microsoft.SharePoint; using Microsoft.SharePoint.Taxonomy; using Microsoft.SharePoint.Publishing.Navigation;

namespace NavigationDemos { public class Class1 { public static readonly Guid NavTermSetId = new Guid("&lt;GUID&gt;"); public static readonly Guid TaggingTermSetId = new Guid("&lt;GUID&gt;");

    //Creates the sample term set. If it exists, it will be deleted
    public static NavigationTermSet RecreateSampleNavTermSet(TaxonomySession taxonomySession, SPWeb web)
    {
        // Use the first TermStore in the list
        if (taxonomySession.TermStores.Count == 0)
            throw new InvalidOperationException("The Taxonomy Service is offline or missing");

        TermStore termStore = taxonomySession.TermStores[0];

        // Does the TermSet already exist?
        TermSet existingTermSet = termStore.GetTermSet(NavTermSetId);

        if (existingTermSet != null)
        {
            //If the TermSet exists, delete it.
            existingTermSet.Delete();
            termStore.CommitAll();
        }

        // Create a new TermSet
        Group siteCollectionGroup = termStore.GetSiteCollectionGroup(web.Site);
        TermSet termSet = siteCollectionGroup.CreateTermSet("Navigation Demo", NavTermSetId);
        NavigationTermSet navTermSet = NavigationTermSet.GetAsResolvedByWeb(termSet, web,
            StandardNavigationProviderNames.GlobalNavigationTaxonomyProvider);
        navTermSet.IsNavigationTermSet = true;
        navTermSet.TargetUrlForChildTerms.Value = "~site/Pages/Topics/Topic.aspx";
        NavigationTerm term1 = navTermSet.CreateTerm("Term 1", NavigationLinkType.SimpleLink);
        term1.SimpleLinkUrl = "http://www.bing.com/";
        NavigationTerm term2 = navTermSet.CreateTerm("Term 2", NavigationLinkType.FriendlyUrl);
        NavigationTerm term2a = term2.CreateTerm("Term 2 A", NavigationLinkType.FriendlyUrl);
        NavigationTerm term2b = term2.CreateTerm("Term 2 B", NavigationLinkType.FriendlyUrl);
        NavigationTerm term3 = navTermSet.CreateTerm("Term 3", NavigationLinkType.FriendlyUrl);
        termStore.CommitAll();

        return navTermSet;
    }

    //Configures the web site to use Taxonomy navigation with the sample term set.
    public static NavigationTermSet SetUpSampleNavTermSet(TaxonomySession taxonomySession, SPWeb web)
    {
        NavigationTermSet termSet = RecreateSampleNavTermSet(taxonomySession, web);

        // Clear out any old settings
        WebNavigationSettings webNavigationSettings = new WebNavigationSettings(web);
        webNavigationSettings.ResetToDefaults();
        webNavigationSettings.GlobalNavigation.Source = StandardNavigationSource.TaxonomyProvider;
        webNavigationSettings.GlobalNavigation.TermStoreId = termSet.TermStoreId;
        webNavigationSettings.GlobalNavigation.TermSetId = termSet.Id;
        webNavigationSettings.CurrentNavigation.Source = StandardNavigationSource.TaxonomyProvider;
        webNavigationSettings.CurrentNavigation.TermStoreId = termSet.TermStoreId;
        webNavigationSettings.CurrentNavigation.TermSetId = termSet.Id;
        webNavigationSettings.Update(taxonomySession);
        TaxonomyNavigation.FlushSiteFromCache(web.Site);

        return termSet;
    }
}

}

Remarks

This class is analogous to the Term class in the Microsoft.SharePoint.Taxonomy namespace.

The NavigationTerm class adds properties and operations that are specific to managed navigation. The additional state is stored in the Microsoft.SharePoint.Taxonomy.Term.CustomPropeties property and should only be accessed via classes in the Microsoft.SharePoint.Publishing.Navigation namespace. A NavigationTerm object belongs to a NavigationTermSet object.

The NavigationTerm and Microsoft.SharePoint.Navigation.NavigationTermSet objects have two modes: an “editable” mode and a “read-only” mode. NavigationTerm objects are stored in the taxonomy navigation cache, which can be accessed by using functions in the Microsoft.SharePoint.Publihsing.Navigation.TaxonomyNavigation static class.

Properties

AssociatedFolderUrl AssociatedFolderUrl AssociatedFolderUrl

Gets or sets the URL value that is used to associate some page URLs with this NavigationTerm object to indicate the location of the properties in the site map provider hierarchy.

CatalogTargetUrl CatalogTargetUrl CatalogTargetUrl

Gets the target URL that is used when rewriting URLs for catalog-friendly URLs that are based on this NavigationTerm object.

CatalogTargetUrlForChildTerms CatalogTargetUrlForChildTerms CatalogTargetUrlForChildTerms

Gets the default value of the Microsoft.SharePoint.Publishing.Navigation.NavigationTermSetItem.CatalogTargetUrl property for child NavigationTerm objects.

(Inherited from NavigationTermSetItem)
CategoryImageUrl CategoryImageUrl CategoryImageUrl

Gets or sets the specified URL of an image that optionally can be displayed by a template page.

ExcludeFromCurrentNavigation ExcludeFromCurrentNavigation ExcludeFromCurrentNavigation

Gets or sets whether this navigation term and its child terms are hidden from the current navigation menu.

ExcludeFromGlobalNavigation ExcludeFromGlobalNavigation ExcludeFromGlobalNavigation

Gets or sets a value that indicates whether the navigation term and its child terms are hidden from the global navigation menu.

FriendlyUrlSegment FriendlyUrlSegment FriendlyUrlSegment

Gets a custom friendly URL segment for the node that is represented by the NavigationTerm object.

HoverText HoverText HoverText

Gets or sets a description that is typically displayed by a menu or by breadcrumb navigation controls when the mouse hovers over the navigation link.

Id Id Id

Gets the Microsoft.SharePoint.Taxonomy.Term.Id property and Microsoft.SharePoint.Taxonomy.TermSet.Id property from the underlying taxonomy object.

(Inherited from NavigationTermSetItem)
IsDeprecated IsDeprecated IsDeprecated

Indicates whether the NavigationTerm object is deprecated.

IsPinned IsPinned IsPinned

Indicates whether a Term object is a pinned term.

IsPinnedRoot IsPinnedRoot IsPinnedRoot

Indicates whether the underlying Term object is the root of a subtree of pinned terms.

IsReadOnly IsReadOnly IsReadOnly

Gets a Boolean value that indicates whether the object is in “read-only” mode or “editable” mode.

(Inherited from NavigationTermSetItem)
LinkType LinkType LinkType

Gets the type of link for this NavigationTermSetItem object.

(Inherited from NavigationTermSetItem)
Parent Parent Parent

Returns the parent NavigationTerm object.

SimpleLinkUrl SimpleLinkUrl SimpleLinkUrl

Gets or sets the target URL if the navigation node represents a simple link.

TargetUrl TargetUrl TargetUrl

Gets the URL of a publishing page that is used to render a friendly URL.

TargetUrlForChildTerms TargetUrlForChildTerms TargetUrlForChildTerms

Gets a string that specifies the default value of the target URL for child NavigationTerm objects.

(Inherited from NavigationTermSetItem)
TaxonomyName TaxonomyName TaxonomyName

Gets a Name property or a Name property from the underlying taxonomy object.

(Inherited from NavigationTermSetItem)
Terms Terms Terms

Gets a collection of all immediate child Microsoft.Sharepoint.Publishing.Navigation.NavigationTerm objects of this NavigationTerm object or NavigationTermSet object.

(Inherited from NavigationTermSetItem)
TermSet TermSet TermSet

Gets the associated NavigationTermSet object that the NavigationTerm belongs to.

Title Title Title

Gets a navigation node title that is displayed in menus and breadcrumbs.

(Inherited from NavigationTermSetItem)
View View View

Gets a NavigationTermSetView object that is used for various purposes such as to resolve relative URLs.

(Inherited from NavigationTermSetItem)

Methods

CreateTerm(String, NavigationLinkType) CreateTerm(String, NavigationLinkType) CreateTerm(String, NavigationLinkType)

Creates a new NavigationTerm object that will be a child of this NavigationTermSetItem object.

(Inherited from NavigationTermSetItem)
CreateTerm(String, NavigationLinkType, Guid) CreateTerm(String, NavigationLinkType, Guid) CreateTerm(String, NavigationLinkType, Guid)

Creates a new NavigationTerm object with the specified termName.

(Inherited from NavigationTermSetItem)
Delete() Delete() Delete()

Deletes this NavigationTerm object and its child objects from the associated TermStore object.

GetAsEditable(TaxonomySession) GetAsEditable(TaxonomySession) GetAsEditable(TaxonomySession)

Returns an editable version of a NavigationTerm object.

GetAsEditableTermSetItem(TaxonomySession) GetAsEditableTermSetItem(TaxonomySession) GetAsEditableTermSetItem(TaxonomySession)

This member is reserved for internal use and is not intended to be used directly from your code.

GetAsResolvedByView(Term, NavigationTermSetView) GetAsResolvedByView(Term, NavigationTermSetView) GetAsResolvedByView(Term, NavigationTermSetView)

Constructs a NavigationTerm object in editable mode that is bound to the specified Term object.

GetAsResolvedByWeb(Term, SPWeb, String) GetAsResolvedByWeb(Term, SPWeb, String) GetAsResolvedByWeb(Term, SPWeb, String)

Constructs an editable NavigationTerm object that is bound to a specified Term object.

GetCustomizableStringCustomValue(Enum) GetCustomizableStringCustomValue(Enum) GetCustomizableStringCustomValue(Enum)

This member is reserved for internal use and is not intended to be used directly from your code.

(Inherited from NavigationTermSetItem)
GetCustomizableStringDefaultValue(Enum) GetCustomizableStringDefaultValue(Enum) GetCustomizableStringDefaultValue(Enum)

This member is reserved for internal use and is not intended to be used directly from your code.

GetResolvedAssociatedFolderUrl() GetResolvedAssociatedFolderUrl() GetResolvedAssociatedFolderUrl()

Returns the AssociatedFolderUrl property as a server-relative URL.

GetResolvedDisplayUrl(String) GetResolvedDisplayUrl(String) GetResolvedDisplayUrl(String)

Returns the URL that is displayed in the navigation menus.

(Inherited from NavigationTermSetItem)
GetResolvedTargetUrl(String, String[]) GetResolvedTargetUrl(String, String[]) GetResolvedTargetUrl(String, String[])

Returns a target page address as a server-relative URL from the Microsoft.SharePoint.Publishing.Navigation.NavigationTerm.Url property.

GetResolvedTargetUrlWithoutQuery() GetResolvedTargetUrlWithoutQuery() GetResolvedTargetUrlWithoutQuery()

Returns a target page address as a server-relative URL that does not include a query string.

GetTaxonomyTerm() GetTaxonomyTerm() GetTaxonomyTerm()

Returns the associated Term object if the NavigationTerm object is in the editable mode.

GetTaxonomyTerm(TaxonomySession) GetTaxonomyTerm(TaxonomySession) GetTaxonomyTerm(TaxonomySession)

Retrieves the corresponding taxonomy object (e.g., Term) from the TaxonomySession object provided.

GetTaxonomyTermStore() GetTaxonomyTermStore() GetTaxonomyTermStore()

Returns the associated TermStore if the NavigationTermSetItem object is in the editable mode.

(Inherited from NavigationTermSetItem)
GetTermSetItemWithNewView(NavigationTermSetView) GetTermSetItemWithNewView(NavigationTermSetView) GetTermSetItemWithNewView(NavigationTermSetView)

reservemember

GetWebRelativeFriendlyUrl() GetWebRelativeFriendlyUrl() GetWebRelativeFriendlyUrl()

Returns the friendly URL segments as a concatenated path.

GetWithNewView(NavigationTermSetView) GetWithNewView(NavigationTermSetView) GetWithNewView(NavigationTermSetView)

Returns a new NavigationTerm object based on the NavigationTermSetView that is provided.

Move(NavigationTermSetItem) Move(NavigationTermSetItem) Move(NavigationTermSetItem)

Moves the NavigationTerm object to be a child of the specified NavigationTerm object or NavigationTermSet object.

SetCustomizableStringCustomValue(Enum, String) SetCustomizableStringCustomValue(Enum, String) SetCustomizableStringCustomValue(Enum, String)

This member is reserved for internal use and is not intended to be used directly from your code.

(Inherited from NavigationTermSetItem)
ToString() ToString() ToString()

Returns the string representation of a NavigationTermSetItem object.

(Inherited from NavigationTermSetItem)

Extension Methods

ToJson(Object) ToJson(Object) ToJson(Object)

Applies to