ConsoleAction classe
Representa a classe base que todas as ações de console específico a ser usado no ConsoleDataSource devem herdar.
Inheritance hierarchy
System.Object
System.Web.UI.Control
System.Web.UI.WebControls.WebControl
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ConsoleAction
Namespace: Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions
Assembly: Microsoft.SharePoint.Publishing (em Microsoft.SharePoint.Publishing.dll)
Sintaxe
'Declaração
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public MustInherit Class ConsoleAction _
Inherits WebControl _
Implements IPostBackEventHandler
'Uso
Dim instance As ConsoleAction
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public abstract class ConsoleAction : WebControl,
IPostBackEventHandler
Comentários
O menu Editar Menu, Menu de acesso rápidoou Ações de Site apresentam várias ações para o usuário. Cada um desses menus contém uma instância do objeto de ConsoleDataSource que fornece uma coleção hierárquica de objetos ConsoleNode , alguns dos quais implementam a classe ConsoleAction . Cada implementação dessa classe representa uma ação específica, como a Página Criar, Publicar, Mostrar histórico de versõesou Salvar e parar edição.
O exemplo de código apresentado aqui é simples, mas mostra como uma ação de console deve ser construída. Executar este aplicativo de exemplo adiciona um botão "Salvar e parar edição" no Menu de acesso rápido. Ele requer que a página esteja no modo de edição e se o usuário tem permissões de EditListItem a este objeto de PublishingPage . O exemplo usa ECMAScript (JavaScript, JScript) volta para esse controle e quando ele gera um evento de postback, o evento salva o objeto PublishingPage atual e mostra a página salva no modo de exibição.
Exemplos
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions;
/// Assemblies that need to be referenced in this sample;
/// Microsoft.SharePoint.dll
/// Microsoft.SharePoint.Publishing.dll
/// Microsoft.Web.CommandUI.dll
namespace Microsoft.SDK.SharePointServer.Samples.Publishing.RteExtensions
{
public class RteExtensionsAction : ConsoleAction
{
/// <summary>
/// This Console Action will include on the client a reference to RteExtension.js file
/// on pages that have a Rich Text Editor.
/// </summary>
public RteExtensionsAction()
: base()
{
}
/// <summary>
/// Gets the rights required for this console action to be active on the page.
///
/// For this example, we will have the same value as the Publishing Rich Text Editor
/// which requires Edit List Item Right, since we want to activate under
/// the same circumstances.
/// </summary>
/// <value>
/// The rights required for this console action to be active on the page.
/// </value>
public override SPBasePermissions UserRights
{
get { return SPBasePermissions.EditListItems; }
}
/// <summary>
/// The value returned by this function represents a list of Ribbon tabs, if these
/// ribbon tabs are currently shown, then this console action will be activate on this page.
///
/// For this example, we are specifying the Format Text tab, which is requested
/// when the Publishing Rich Text Editor is on the page. Also, we are adding a new
/// button to this tab, and hence we want to activate when that button is present on
/// the page.
/// </summary>
/// <returns>
/// A list of ribbon tabs for which the ConsoleAction is activated.
/// </returns>
public override string[] GetRibbonTabIdsWhereConsoleActionIsShown()
{
return new string[] { SPRibbon.EditTabId };
}
/// <summary>
/// If the UserRights are met and the Ribbon Tabs have been found, then this method will be called.
/// This is where you register your appropriate ribbon files and send to the client data it requires.
///
/// For this example, we will tell SharePoint ScriptLink about the existance of RteExtensions.js.
/// This will allow code on the client to download it on demand.
/// The second part will register a startup script that will download RteExtensions.js once the
/// SharePoint rich text editor file (sp.ui.rte.js) has finished downloaded.
/// </summary>
public override void RegisterClientData()
{
// Register the extension script, such that it can be downloaded on demand.
ScriptLink.RegisterOnDemand(this.Page, "RteExtensions.js", false);
// Download the RteExtension script when the SharePoint RTE has finished downloaded.
string onDemandScript = @"
// This method informs SharePoint to start downloading the Script On Demand
// file that was registered on the server.
function loadRteExtensions()
{
// Include the RteExtensions.js if it is not already on the page.
var defd;
try
{
defd = typeof(RteExtensions);
}
catch (e)
{
defd = 'undefined';
}
EnsureScript('RteExtensions.js', defd, null);
}
// This method is run when the body has finished loading.
// Inform SharePoint to wait until the rich text editor has been
// downloaded on the page before including the rte extensions.
function loadExtensionsDependencies()
{
ExecuteOrDelayUntilScriptLoaded(loadRteExtensions, 'sp.ui.rte.js');
}
// Add to the SharePoint array of functions to call when the
// body of the document has finished loading
// Wait for the page to have completed to load
// this will make sure that all script on demand information
// has been processed by SharePoint.
if (_spBodyOnLoadFunctionNames != null)
{
_spBodyOnLoadFunctionNames.push('loadExtensionsDependencies');
}
";
Page.ClientScript.RegisterStartupScript(typeof(RteExtensionsAction), "RteExtensionsAction", onDemandScript, true);
}
}
}
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.
Ver também
Referência
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions namespace
Inheritance hierarchy
System.Object
System.Web.UI.Control
System.Web.UI.WebControls.WebControl
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ConsoleAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ApproveOrDeclineAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.BaseApproveAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.BaseDeclineAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.BrowseWebPartsAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CancelApprovalRequestAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CancelApprovalWorkflowRequestAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CancelSchedulingAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CheckInAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CheckInWithCommentAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CheckOutAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CheckOutOverrideAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CopyAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CreateNewPublishingPageAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CreateNewSiteAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CreateNewsLinkAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CreatePageVariationAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CreateSiteVariationAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.DeleteAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.DesignSiteAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.DeviceChannelReorderingAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.EditListItemPropertiesAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.EditPropertiesAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.EditSeoPropertiesAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ExitMenuAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ExitWithoutSavingAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ForceSavePublishingPageAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ImportWebPartsAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ManageSiteAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ModifyNavigationAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ModifyPagesLibrarySettingsAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.MoveAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.OneClickPublishAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.PageLayoutAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.PersonalViewAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.PreviewAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.PreviewExistingPublishingPageAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.PublishAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.PublishWithCommentAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.QuickDeployAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ReviewPublishingPageAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.RevisionHistoryAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.RTEV4Action
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SavePublishingPageAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SchedulingAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SearchWebPartsAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SharedViewAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ShowUnapprovedResourcesAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SiteDirectoryBrokenLinksCheckerAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SiteSettingsAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SpellCheckEntirePageAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SwitchToAuthoringModeAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SwitchToPublishedModeAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.UndoCheckOutAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.UnpublishAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.VersionDifferenceAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.VersionInfoAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ViewAllSiteContentAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ViewChangesPageVariationAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ViewRecycleBinAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.WorkflowStartAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.WorkflowStatusAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.WorkflowTasksAction
Microsoft.SharePoint.Publishing.WebControls.SmallBusinessWebsiteConsoleAction
Microsoft.SharePoint.Publishing.WebControls.SpellCheckV4Action