Compartir a través de


Clase ConsoleNode

Representa la estructura básica que se utiliza para el menú de consola .

Jerarquía de la herencia

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

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

Sintaxis

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

Comentarios

Cada objeto de ConsoleNode puede tener, opcionalmente, los objetos secundarios ConsoleNode y consola ConsoleAction objetos asociados. Interfaces de usuario de acción como el menú de Edición , el botón de Acceso rápido o el menú Acciones del sitio presentan varias acciones al usuario. Cada uno de ellos tiene una instancia del objeto ConsoleDataSource que proporciona una colección jerárquica de objetos ConsoleNode . Algunos objetos de ConsoleNode implementan la clase ConsoleAction de una manera específica.

Cuando se define la propiedad Action para un ConsoleNode como un ConsoleAction, se utilizan las propiedades de la ConsoleAction, como DisplayText y NavigateUrl, como las propiedades con los mismos nombres en la ConsoleNode.

Cuando se define una propiedad, como ImageUrl, en un objeto de ConsoleNode y un objeto ConsoleAction que hace referencia a la ConsoleNode , el valor especificado en el ConsoleNode reemplaza el valor de la referencia ConsoleAction si se ha establecido el valor booleano correspondiente. En este caso, establecer la propiedad UseActionImageUrl en false hace que el ConsoleNode se reemplaza la propiedad ConsoleAction .

Cada instancia de esta clase representa una acción o un submenú. Por ejemplo, en el menú Acciones del sitio , si un ConsoleNode tiene al menos un elemento secundario de la colección ChildConsoleNodes , parece como la raíz de un submenú con el niño ConsoleNodes que aparece en el submenú. Si la ConsoleNode no tiene ningún objeto secundario, aparece como una acción seleccionable.

Ejemplos

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

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 ConsoleNode

Espacio de nombres Microsoft.SharePoint.Publishing.WebControls