Presentation on theme: "LH SharePoint SIG - Custom Actions. Custom Actions A custom action represents a Server ribbon, menu, or link customization that a user can see. Custom."— Presentation transcript:
Custom Actions A custom action represents a Server ribbon, menu, or link customization that a user can see. Custom actions can be bound to list type, content type, file type, or programmatic identifier (ProgID). Possible scopes: Farm: Yes Web Application: Yes Site Collection: Yes Web Site: Yes We will create a custom action associated with the ribbon for a particular content type at Site scope
Getting Started Our action will allow us to copy Wiki Pages from a Wiki Page Library to another named “Squirrel Wiki Pages” Create new Visual Studio 2010 Empty SharePoint project Add New Item – Empty Element – Squirrel Action Rename Feature to Squirrel Action Add CustomAction element to elements.xml Add Layouts folder for image and add image Deploy and Test This is a dumb Custom Action since it does not do anything. Lets put some meat on the bone…
CustomAction Element How did I determine RegistrationType and RegistrationId? – Go To Site Settings/ Site Content Types – Hover over “Wiki Page” and look at ctype param in the status bar How did I determine Locations? – Default Custom Action Locations and IDs Default Custom Action Locations and IDs – 14 Hive/TEMPLATE/GLOBAL/XML/CMDUI.XML How did I determine TemplateAlias? – 14 Hive/TEMPLATE/GLOBAL/XML/CMDUI.XML
Action Handling by Delegate The following technique allows handling the command “Server Side” We will create a class inherited from WebControl and use it to handle the command The control will be added to the AdditionalPageHead Delegate control The CommandUIHandler will execute a postback that the control will handle Replace the Custom Action element Add the SquirrelControl class Add reference to Microsoft.SharePoint, System.Web and System.WebExtensions Add a Safe Controls entry
Useful References Customizing and Extending the SharePoint 2010 Server Ribbon Server Ribbon XML Using the SharePoint Foundation 2010 Managed Client Object Model SPListTemplateType Enumeration
Your consent to our cookies if you continue to use this website.