Compartir a través de


Clase Label

Representa el nombre de un objeto Term en un idioma específico.

Jerarquía de la herencia

System.Object
  Microsoft.SharePoint.Taxonomy.Label

Espacio de nombres:  Microsoft.SharePoint.Taxonomy
Ensamblado:  Microsoft.SharePoint.Taxonomy (en Microsoft.SharePoint.Taxonomy.dll)

Sintaxis

'Declaración
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class Label
'Uso
Dim instance As Label
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class Label

Comentarios

Aterm puede tener una o varias etiquetas en el idioma predeterminado y cero o más etiquetas en el lenguaje no predeterminada. Si el término tiene etiquetas en un idioma, una de las etiquetas debe ser la etiqueta predeterminada.

Ejemplos

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);
            }
        }
    }
}

Seguridad para subprocesos

Los miembros static (Shared en Visual Basic) públicos de este tipo son seguros para subprocesos. No se garantiza que los miembros de instancias sean seguros para los subprocesos.

Vea también

Referencia

Miembros Label

Espacio de nombres Microsoft.SharePoint.Taxonomy

Term