Label - Classe
Représente le nom d'un objet Term dans une langue spécifique.
Hiérarchie d’héritage
System.Object
Microsoft.SharePoint.Taxonomy.Label
Espace de noms : Microsoft.SharePoint.Taxonomy
Assembly : Microsoft.SharePoint.Taxonomy (dans Microsoft.SharePoint.Taxonomy.dll)
Syntaxe
'Déclaration
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class Label
'Utilisation
Dim instance As Label
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class Label
Remarques
Aterm peut avoir une ou plusieurs étiquettes dans la langue par défaut et zéro, une ou plusieurs étiquettes dans la langue par défaut. Si le terme dispose d'étiquettes dans une langue, une des étiquettes doit être l'étiquette par défaut.
Exemples
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);
}
}
}
}
Cohérence de thread
Tous les membres statique (Partagé dans Visual Basic)s publics de ce type sont thread-safe. Cela n’est pas garanti pour les membres d’instance.