ConsoleNode classe
Representa a estrutura básica usada para o menu do Console .
Inheritance hierarchy
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 (em Microsoft.SharePoint.Publishing.dll)
Sintaxe
'Declaração
<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
Comentários
Cada objeto ConsoleNode opcionalmente pode ter objetos de ConsoleNode filho e associadas a objetos de ConsoleAction do console. Interfaces de usuário de ação como o menu de edição , o botão de Acesso rápido ou o menu Ações do Site apresentam várias ações para o usuário. Cada um deles possui uma instância do objeto de ConsoleDataSource que fornece uma coleção hierárquica de objetos ConsoleNode . Alguns objetos ConsoleNode implementam a classe de ConsoleAction de uma maneira específica.
Quando a propriedade Action para um ConsoleNode é definida como uma ConsoleAction, as propriedades de ConsoleAction, como DisplayText e NavigateUrl, são usadas como propriedades com os mesmos nomes na ConsoleNode.
Quando uma propriedade, como ImageUrl, é definida em um objeto de ConsoleNode e um objeto de ConsoleAction que faz referência a ConsoleNode , o valor especificado no ConsoleNode substitui o valor de referência ConsoleAction se o valor de Boolean correspondente tiver sido definido. Nesse caso, definindo a propriedade UseActionImageUrl como false faz com que o ConsoleNode substituir a propriedade ConsoleAction .
Cada ocorrência dessa classe representa uma ação ou um submenu. Por exemplo, no menu Ações do Site , se um ConsoleNode tem pelo menos um filho na coleção ChildConsoleNodes , ele aparece como a raiz de um submenu com o filho ConsoleNodes que aparecem no submenu. Se o ConsoleNode não tem nenhum objeto filho, ele aparece como uma ação que pode ser clicada.
Exemplos
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;
}
}
}
}
Segurança de thread
Os membros públicos estática (Shared no Visual Basic) desse tipo são seguros para thread. Nenhum membro de instância pode ser garantido como seguro para thread.