Table of contents
TOC
Collapse the table of content
Expand the table of content

NavigationExtensions.AddCustomAction Method

SharePoint Dev Documents|Last Updated: 5/20/2017
|
1 Contributor

Adds custom action to a web. If the CustomAction exists the item will be updated. Setting CustomActionEntity.Remove == true will delete the CustomAction.

Namespace:Microsoft.SharePoint.Client
Assembly: OfficeDevPnP.Core.dll

Syntax

public static bool AddCustomAction(this Web web, CustomActionEntity customAction)

Parameters

web

  Type: Microsoft.SharePoint.Client.Web
  Site to be processed - can be root web or sub site

customAction

  Type: OfficeDevPnP.Core.Entities.CustomActionEntity
  Information about the custom action be added or deleted

Return Value

Type: bool
True if action was successfull

Examples

var editAction = new CustomActionEntity()
{
   Title = "Edit Site Classification",
   Description = "Manage business impact information for site collection or sub sites.",
   Sequence = 1000,
   Group = "SiteActions",
   Location = "Microsoft.SharePoint.StandardMenu",
   Url = EditFormUrl,
   ImageUrl = EditFormImageUrl,
   Rights = new BasePermissions(),
};
editAction.Rights.Set(PermissionKind.ManageWeb);
web.AddCustomAction(editAction);

See also

© 2018 Microsoft