Label Label Label Class

Definition

Represents the name of a Term object in a specific language.

public ref class Label sealed
[Microsoft.SharePoint.Client.ClientCallableType(ClientLibraryTargets=Microsoft.SharePoint.Client.ClientLibraryTargets.NonRESTful, FactoryType=typeof(Microsoft.SharePoint.Taxonomy.Internal.TaxonomyClientObjectFactory), ObjectIdentityPropertyName="CanonicalId", ServerTypeId="81503AE1-8747-4684-A172-163C7E009EF9")]
public sealed class Label
Public NotInheritable Class Label
Inheritance
LabelLabelLabel
Attributes
Microsoft.SharePoint.Client.ClientCallableTypeAttribute

Examples

<pre><code>using System;

using System.IO; using System.Globalization; using System.Collections.Specialized; using Microsoft.SharePoint; using Microsoft.SharePoint.Taxonomy;

namespace Microsoft.SDK.SharePointServer.Samples { public static class LabelSamples { public static void UseLabel(TermStore store, Term term, string newLabel) { // Show all the labels in current language DisplayLabels(term);

        Console.WriteLine("Adding a new label");

        // Create a new label
        Label label = term.CreateLabel(newLabel,
            CultureInfo.CurrentUICulture.LCID,
            false);

        // Commit the change into the TermStore
        store.CommitAll();

        // Show all the labels in current language
        DisplayLabels(term);

        // Set the new label as the default label for current language
        label.SetAsDefaultForLanguage();

        // Commit the change into the TermStore
        store.CommitAll();

        // Show all the labels in current language
        DisplayLabels(term);
    }

    public static void DisplayLabels(Term term)
    {
        // Show all the labels in current language
        foreach (Label termLabel in term.Labels)
        {
            Console.WriteLine("The term has label: \"" + termLabel.Value
                + "\" and IsDefault is " + termLabel.IsDefaultForLanguage);
        }
    }
}

}

Remarks

Aterm can have one or more labels in the default language, and zero or more labels in the non-default language. If the term has labels in a language, one of the labels must be the default label.

Properties

IsDefaultForLanguage IsDefaultForLanguage IsDefaultForLanguage

Indicates whether this Label object is the default label for the label's language.

Language Language Language

Indicates the locale of the current Label object.

Term Term Term

Returns the Term object that the current Label object is associated with.

Value Value Value

Gets the value of the current Label object.

Methods

Delete() Delete() Delete()

Deletes the current Label object.

SetAsDefaultForLanguage() SetAsDefaultForLanguage() SetAsDefaultForLanguage()

Sets the current Label object as the default label for its language.

Extension Methods

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

Applies to