TaxonomyWebTaggingControl-Klasse

Stellt ein generisches Websteuerelement zum Auswählen verwalteter Metadatenausdrücke dar.

Vererbungshierarchie

System.Object
  System.Web.UI.Control
    System.Web.UI.WebControls.WebControl
      Microsoft.SharePoint.Taxonomy.TaxonomyWebTaggingControl

Namespace:  Microsoft.SharePoint.Taxonomy
Assembly:  Microsoft.SharePoint.Taxonomy (in Microsoft.SharePoint.Taxonomy.dll)

Syntax

'Declaration
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public NotInheritable Class TaxonomyWebTaggingControl _
    Inherits WebControl
'Usage
Dim instance As TaxonomyWebTaggingControl
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public sealed class TaxonomyWebTaggingControl : WebControl

Hinweise

Ein TaxonomyWebTaggingControl -Objekt ist ein Websteuerelement, das einer Seite hinzugefügt werden kann, damit ein Benutzer eine oder mehrere Taxonomie Term -Objekt von einem bestimmten TermSet Objekt oder von einem gesamten TermStore Objekt auswählen kann.

Dieses Steuerelement wird sichergestellt, dass alle Bedingungen gelten, ist dies nicht der Fall ist, erfordert es Validierung der Benutzer, wenn einen ungültigen Ausdruck gefunden. Wenn die TermStore oder TermSet -Verbindung kann nicht hergestellt werden, wird die TaxonomyWebTaggingControl deaktiviert.

Beispiele

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

namespace Microsoft.SDK.SharePointServer.Samples 
{
    public class TestTaxonomyWebTaggingControl : System.Web.UI.Page
    {
        // In order to place the TaxonomyWebTaggingControl on an aspx page use the following declaration:
        // <Taxonomy:TaxonomyWebTaggingControl id="myTaxonomyControl" runat="server" />
        protected TaxonomyWebTaggingControl myTaxonomyControl;

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (IsPostBack)
            {
                // since this is a PostBack we want to validate
                string errorMessage = string.Empty;
                if (myTaxonomyControl.Validate(out errorMessage))
                {
                    string value = myTaxonomyControl.Text;
                    // now do what you want with the value returned from the control.
                }
                else
                {
                    // The data was not valid so you need to inform the user
                    throw new Exception("The data entered was not valid");
                }
            }
            else
            {
                TaxonomySession taxonomySession = new TaxonomySession(SPContext.Current.Site);

                // This code assumes you have a term store and term set set up already (we are just taking the first one
                myTaxonomyControl.SSPList = taxonomySession.TermStores[0].Id.ToString();
                myTaxonomyControl.TermSetList = taxonomySession.TermStores[0].Groups[0].TermSets[0].Id.ToString();
                myTaxonomyControl.GroupId = taxonomySession.TermStores[0].Groups[0].Id;
                // This controls whether you can add new terms to the term set
                myTaxonomyControl.AllowFillIn = false;
                // This controls whether we use an anchor term or not (by setting it to Empty we are explicitly choosing
                // not to)
                myTaxonomyControl.AnchorId = Guid.Empty;
                // Since we are bound to a specific term set and not spanning term sets the following property really does nothing
                myTaxonomyControl.ExcludeKeyword = false;
                // This controls whether unresolved terms will just be added to the termset or not
                myTaxonomyControl.IsAddTerms = false;
                // This setting allows you to browse the term set
                myTaxonomyControl.IsDisplayPickerButton = true;
                // This setting enables/disables validation highlighting
                myTaxonomyControl.IsIgnoreFormatting = false;
                myTaxonomyControl.IsIncludeDeprecated = false;
                myTaxonomyControl.IsIncludeUnavailable = false;
                // This setting modifies what is stored/returned from the control, if you want the GUIDS of parent terms
                // then set this to true
                myTaxonomyControl.IsIncludePathData = false;
                // This setting will include term set name resolution as well if set
                myTaxonomyControl.IsIncludeTermSetName = false;
                // This allows or disallows multiple values to be selected
                myTaxonomyControl.IsMulti = false;
                // We are searching on a specific termset so set these to false
                myTaxonomyControl.IsSpanTermSets = false;
                myTaxonomyControl.IsSpanTermStores = false;
                myTaxonomyControl.IsUseCommaAsDelimiter = false;
                // This is the LCID of the language to resolve terms against
                myTaxonomyControl.Language = taxonomySession.TermStores[0].DefaultLanguage;

                // This has a default value, however, if you want to customize what web service it uses you can
                // change the URL.
                myTaxonomyControl.WebServiceUrl = new Uri(SPContext.Current.Web.Url + "/_vti_bin/TaxonomyInternalService.json");

                myTaxonomyControl.SetCannotBeBlankErrorMessage("This control should not be blank");

                // If you want to modify the width/height of the control you will need to use the WidthCss/HeightCss 
                // properties and set them to a css class that defines the width/height properties.  The code would
                // be:
                // myTaxonomyControl.WidthCss = "my-css-class";
                // myTaxonomyControl.HeightCss = "my-css-class";
            }

        }
    }
}

Threadsicherheit

Alle öffentlichen static (Shared in Visual Basic) Member dieses Typs sind threadsicher. Die Threadsicherheit von Instanzmembern ist nicht gewährleistet.

Siehe auch

Referenz

TaxonomyWebTaggingControl-Member

Microsoft.SharePoint.Taxonomy-Namespace