ConsoleNode-Klasse

Stellt die Grundstruktur für das Konsolenmenü verwendet.

Vererbungshierarchie

System.Object
  Microsoft.SharePoint.Publishing.WebControls.ConsoleNode
    Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ModifyWebPartsNode
    Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ReportsNode

Namespace:  Microsoft.SharePoint.Publishing.WebControls
Assembly:  Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)

Syntax

'Declaration
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public Class ConsoleNode
'Usage
Dim instance As ConsoleNode
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public class ConsoleNode

Hinweise

Jedes ConsoleNode Objekt untergeordneten ConsoleNode Objekte optional sind und zugeordnete Konsole ConsoleAction Objekte. Aktion-Benutzeroberflächen wie das Bearbeitungsmenü , Schnellzugriff Schaltfläche oder Menü Websiteaktionen bieten dem Benutzer verschiedene Aktionen. Jedes davon verfügt über eine Instanz des ConsoleDataSource -Objekts, das eine hierarchische Auflistung von ConsoleNode -Objekten enthält. Einige ConsoleNode -Objekte implementieren die ConsoleAction -Klasse auf eine bestimmte Weise.

Wenn die Eigenschaft Action für ein ConsoleNode als ein ConsoleActiondefiniert ist, werden die Eigenschaften der ConsoleAction, wie DisplayText und NavigateUrl, als Eigenschaften mit denselben Namen in der ConsoleNodeverwendet.

Eine Eigenschaft, z. B. ImageUrl, ein ConsoleNode -Objekt und ein ConsoleAction -Objekt, das die ConsoleNode verweist auf definiert ist, überschreibt in der ConsoleNode angegebene Wert den Wert in der referenzierten ConsoleAction , wenn der entsprechende boolesche Wert festgelegt wurde. In diesem Fall wird das Festlegen der UseActionImageUrl -Eigenschaft auf false der ConsoleNode zum Überschreiben der ConsoleAction -Eigenschaft.

Jede Instanz dieser Klasse steht für eine Aktion oder ein Untermenü. Z. B. besitzt eine ConsoleNode mindestens ein untergeordnetes Element in der Auflistung ChildConsoleNodes erscheint im Menü Websiteaktionen es als Stamm für ein Untermenü mit den untergeordneten ConsoleNodes im Untermenü angezeigt wird. Wenn die ConsoleNode keine untergeordneten Objekte verfügt, wird es als durch Klicken aktivierbar Aktion angezeigt.

Beispiele

using Microsoft.SharePoint;
using Microsoft.SharePoint.Publishing.WebControls;
using Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions;

namespace Microsoft.SDK.SharePointServer.Samples.Publishing.SiteActionsMenuItem
{
    /// <summary>
    /// This sample adds an item to the Site Actions menu, when clicked goes to the Navigation Settings page.
    /// 
    /// The necessary steps to make this sample running:
    /// 1. Create a new C# class library project.
    /// 2. Add this snippet to the project.
    /// 3. Sign the assembly with a strong name.
    /// 4. Add references to the following assemblies:
    ///    a. System.Web
    ///    b. Microsoft.SharePoint
    ///    c. Microsoft.SharePoint.Publishing
    /// 5. Build the project.
    /// 6. Install the assembly to the server's Global Assembly Cache (GAC).
    /// 7. Replace the assembly information given in the following XML snippet with the assembly you have created.
    ///    (trick: An easy way to learn the Public Key Token of the assembly is
    ///            to right click the assembly in GAC and click properties.)
    /// 8. Copy the XML snippet below updated with the assembly information into CustomSiteActions.xml,
    ///    which is in Editing Menu folder in Master Page Gallery.
    ///    (trick: copying can be done as follows; navigate to Site Settings, then Master Page Gallery, and then Editing Menu folder.
    ///            Download a copy of CustomSiteActions.xml, update the local copy and upload back to the server. Finally publish the file.)
    /// 9. Do an iisreset on the server.
    /// 
    /// <references>
    ///     <reference TagPrefix="SharePointServerSamples" 
    ///       assembly="Microsoft.SDK.SharePointServer.Samples.Publishing.SiteActionsMenuItem, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7aa57999e9b11a7c" 
    ///       namespace="Microsoft.SDK.SharePointServer.Samples.Publishing.SiteActionsMenuItem" />
    /// </references>
    /// <structure>
    ///  <ConsoleNode
    ///       Action="SharePointServerSamples:NavigationSettingsAction"  
    ///       MenuGroupId="300"  
    ///       Sequence="390"  
    ///       PermissionContext="CurrentSite"
    ///       HideStates="IsPublishingSiteFalse"
    ///       UIVersion="4"
    ///       ID="sampleNavSetng"/>
    /// </structure>
    /// 
    /// Explanation of the ConsoleNode properties;
    /// * Action is used to define the ConsoleAction that is used with this ConsoleNode.
    /// * MenuGroupId and Sequence define the position of the ConsoleNode inside the Site Actions menu.
    /// * PermissionContext defines the context (CurrentItem, CurrentList, CurrentSite, RootSite) to be used
    ///   while checking if the user has rights to use this ConsoleNode.
    /// * HideStates defines the AuthoringStates for which the ConsoleNode is hidden (not rendered on UI.)
    /// * UIVersion can be used to define a ConsoleNode specific to a UIVersion (v3 or v4).
    /// </summary>
    public class NavigationSettingsAction : ConsoleAction
    {
        /// <summary>
        /// This is the constructor of the specific ConsoleAction.
        /// </summary>
        public NavigationSettingsAction()
            : base()
        {
            this.DisplayText = "Navigation Settings";
            this.Description = "Change the navigation settings for this site";
        }

        /// <summary>
        /// Gets the AuthoringStates required to enable the menu item.
        /// </summary>
        public override AuthoringStates RequiredStates
        {
            get
            {
                return AuthoringStates.EmptyMask;
            }
        }

        /// <summary>
        /// Gets the SPBasePermissions required to use this Console Action.
        /// </summary>
        public override SPBasePermissions UserRights
        {
            get
            {
                return SPBasePermissions.AddAndCustomizePages;
            }
        }

        /// <summary>
        /// Gets the url that the browser navigates to, when the menu item is clicked.
        /// </summary>
        public override string NavigateUrl
        {
            get
            {
                string serverRelativeUrlOfCurrentWeb = SPContext.Current.Web.ServerRelativeUrl;
                string navigationSettingsRelativeUrl = "_layouts/AreaNavigationSettings.aspx";
                string result;

                if (serverRelativeUrlOfCurrentWeb.EndsWith("/"))
                {
                    result = serverRelativeUrlOfCurrentWeb + navigationSettingsRelativeUrl;
                }
                else
                {
                    result = serverRelativeUrlOfCurrentWeb + "/" + navigationSettingsRelativeUrl;
                }

                return result;
            }
        }
    }
}

Threadsicherheit

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

Siehe auch

Referenz

ConsoleNode-Member

Microsoft.SharePoint.Publishing.WebControls-Namespace