ConsoleAction - Classe
Représente la classe de base qui doivent hériter de toutes les actions de console spécifiques à utiliser dans le ConsoleDataSource.
Hiérarchie d’héritage
System.Object
System.Web.UI.Control
System.Web.UI.WebControls.WebControl
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ConsoleAction
Espace de noms : Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions
Assembly : Microsoft.SharePoint.Publishing (dans Microsoft.SharePoint.Publishing.dll)
Syntaxe
'Déclaration
<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
'Utilisation
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
Remarques
Le menu Actions du Site , Menu d'accès rapideou Menu éditionprésente les différentes actions à l'utilisateur. Chacun de ces menus contient une instance de l'objet ConsoleDataSource qui fournit une collection hiérarchique d'objets ConsoleNode , certaines d'entre elles implémentent la classe ConsoleAction . Chaque implémentation de cette classe représente une action spécifique, par exemple Créer une Page, Publier, Afficher l'historique de Versionou Enregistrer et arrêter les modifications.
L'exemple de code présenté ici est simplifiée, mais montre comment une action de console doit être construite. Exécution de cet exemple d'application ajoute un bouton « Enregistrer et arrêter la modification » au Menu d'accès rapide. Elle nécessite que la page est en mode édition et que l'utilisateur dispose des autorisations pour cet objet PublishingPageEditListItem . L'exemple utilise ECMAScript (JavaScript, JScript) pour effectuer une publication sur ce contrôle, et lorsqu'il déclenche un événement de publication (postback), l'événement enregistre l'objet PublishingPage en cours et affiche la page enregistrée en mode d'affichage.
Exemples
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);
}
}
}
Cohérence de thread
Tous les membres statique (Partagé dans Visual Basic)s publics de ce type sont thread-safe. Cela n’est pas garanti pour les membres d’instance.
Voir aussi
Référence
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions - Espace de noms
Hiérarchie d’héritage
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