Creating Custom Actions within SharePoint

  • 2,327 views
Uploaded on

Custom Actions control features in SharePoint such as the Edit Control Block, the Site Actions menu, toolbars, and the links within the Site Settings page. Learn how to leverage Custom Actions to …

Custom Actions control features in SharePoint such as the Edit Control Block, the Site Actions menu, toolbars, and the links within the Site Settings page. Learn how to leverage Custom Actions to extend the SharePoint User Interface. This session will describe the basics of Custom Actions, a demonstration to build one or more and apply them to a site in SharePoint, as well as provide resources for additional information.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,327
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • stsadm -o activatefeature -name SPS.HideCustomAction -url http://site.litwareinc.com

Transcript

  • 1. Creating Custom Actionswithin SharePointGeoff Varosky
  • 2. About Me
    Geoff Varosky MCP, MCTS
    Senior Solutions Developer for Grace-Hunt, LLC.
    Blog: http://www.geoffvarosky.com
    Email: gvarosky@grace-hunt.com
    Twitter: @gvaro
  • 3. About Grace-Hunt
    Founded in 2004
    Based in Hudson, MA
    Presence in North East, Mid Atlantic, and South East Regions
    Microsoft Gold Partner
    Specializing in SharePoint and Dynamics (CRM, SL, GP, NAV) Consulting, Implementation, and Integration
    Web: http://www.grace-hunt.com
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 4. Agenda
    What are Custom Actions?
    Demonstrations
    Creating a Simple Custom Action
    Anatomy of a Custom Action
    Creating a Slightly More Complex Custom Action
    Hiding Custom Actions
    Custom Action Groups
    References
    Q&A
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 5. Examples
    Toolbars
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 6. Examples
    Site Actions Menu
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 7. Examples
    Site Settings
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 8. Examples
    Site Settings (Custom Action Group)
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 9. Examples
    Edit Control Block (ECB)
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 10. Examples
    Central Administration Pages
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 11. Just What Are Custom Actions?
    Per Microsoft –
    “A custom action represents a link, toolbar button, menu item, or any control that can be added to a toolbar or menu that a user sees. Custom actions can be bound to list type, content type, file type, or programmatic identifier (ProgID).”
    Source: http://snipurl.com/d8y70
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 12. Just What Are Custom Actions?
    What does that mean?
    Bits of XML
    Deployed via Features
    Create a Link within SharePoint
    Specific Location
    JavaScript, AJAX, URLs, etc.
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 13. Just What Are Custom Actions?
    What does that mean?
    Custom Actions can be bound to List Types
    A Custom Action can be bound to a Document Library, but, may not be bound to a Task List
    Example: Check In/Check Out
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 14. Just What Are Custom Actions?
    What does that mean?
    Custom Actions can be bound to File Types
    Example: ‘Edit in Microsoft Word’ bound to Word (.doc, .docx) document types
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 15. Just What Are Custom Actions?
    What does that mean?
    Custom Actions can be bound to Content Types
    Example: Folders, Document Content Types, List Content Types, etc.
    Programmatic Identifiers
    Example: Task List Identifier (107)
    http://snipurl.com/ntd5g
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 16. What Can Custom Actions Do?
    But wait, there’s more!
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 17. What Can Custom Actions Do?
    But wait, there’s more!
    Create links to pages that really should be there…
    Example: There is a link to the Site Collection Recycle Bin on the Site Settings page, however, there is no link to the current site Recycle Bin. (Demo #1)
    Custom Actions can pass along information to act upon
    Example: Add a “Complete Task” action to an Edit Control Block, which calls an ASPX page, taking the parameters of the List ID and Item ID, and updating the task item within a list. (Demo #2)
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 18. What Can Custom Actions Do?
    …and more
    Custom Actions can also be hidden
    Example: You do not want site administrators to be able to delete their sites by using the Delete This Site link on the Site Settings page so, we can remove it by using HideCustomAction (Demo #3)
    Create Groupings of Custom Actions by using CustomActionGroup
    Example: Create a grouping of your Custom Actions on the Site Settings page for all of your Custom Actions… (Demo #4)
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 19. What Tools Are Needed?
    Notepad
    What do I use?
    Visual Studio
    Andrew Connell’s SharePoint Project Utility for Visual Studio
    http://snipurl.com/d8yv9
    Requires DevExpress DX Core to be installed (free)
    WSPBuilder (CodePlex)
    http://snipurl.com/d8yxv
    SharePoint Solution Installer (CodePlex)
    http://snipurl.com/nt6ux
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 20. Demo
    Creating a Simple
    Custom Action
    View Demo: http://www.vimeo.com/9728285
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 21. Anatomy of a Custom Action
    Feature Definition (feature.xml)
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 22. Anatomy of a Custom Action
    Scope
    • Web
    • 23. A “sub-site”
    • 24. Only activates the feature on the specific web
    • 25. Site
    • 26. Site Collection
    • 27. Applies to all webs within the site collection
    • 28. Web Application
    • 29. Applies to all site collections and webs within a web application
    • 30. Farm
    • 31. Applies to all web applications, site collections, etc.....
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 32. Anatomy of a Custom Action
    Element Manifest (manifest.xml)
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 33. Anatomy of a Custom Action
    <CustomAction
    ContentTypeId = "Text"
    ControlAssembly = "Text"
    ControlClass = "Text"
    ControlSrc = "Text"
    Description = "Text"
    GroupId = "Text"
    Id = "Text"
    ImageUrl = "Text"
    Location = "Text"
    RegistrationId = "Text"
    RegistrationType = "Text"
    RequireSiteAdministrator = "TRUE" | "FALSE"
    Rights = "Text"
    Sequence = "Integer"
    ShowInLists = "TRUE" | "FALSE"
    ShowInReadOnlyContentTypes = "TRUE" | "FALSE"
    ShowInSealedContentTypes = "TRUE" | "FALSE"
    Title = "Text">
    </CustomAction>
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 34. Anatomy of a Custom Action
    Id (optional)
    • Specifies a unique identifier for custom action
    • 35. May be a GUID or a unique term
    • 36. Example:DeleteWeb
    GroupID(optional)
    • Identifies the unique group that this element is contained in
    • 37. Example:SiteAdministration
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 38. Anatomy of a Custom Action
    Location (optional)
    • Specifies the location for this custom action
    • 39. Example:Microsoft.SharePoint.SiteSettings
    RegistrationType(optional)
    • Specifies the list, item content type, file type, or programmatic identifier that this action is associated with
    • 40. Example: List
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 41. Anatomy of a Custom Action
    RegistrationId(optional)
    • Specifies the registration attachment for a per-item action
    • 42. Example (List Identifier – Task List): 107 (http://snipurl.com/ntd5g)
    Title (required)
    • Specifies the name of your action
    • 43. Example: DeleteWeb
    Description (optional)
    • Longer description for action which is shown as a tooltip or sub-description (where applicable) for the action
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 44. Anatomy of a Custom Action
    Sequence (optional)
    • The order in which your action will appear.
    • 45. If not specified, displayed in the order it is read by SharePoint by Feature and by order in element listing (XML).
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 46. Anatomy of a Custom Action
    Permissions
    • RequireSiteAdministrator (optional)
    • 47. Boolean (True or False)
    • 48. Cannot be used on ECB menu list items
    • 49. Rights
    • 50. Specify rights needed for this Custom Action to be visible
    • 51. Example: “ApproveItems,DeleteListItems”
    • 52. Possible Values http://snipurl.com/ntcz5
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 53. Anatomy of a Custom Action
    UrlAction Tokens
    • ~site
    • 54. References the current SPWeb context
    • 55. ~sitecollection
    • 56. References the current SPSite context
    • 57. {ItemId}
    • 58. GUID of the item action is called from
    • 59. {ItemUrl}
    • 60. URL of the item the action is called from
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 61. Anatomy of a Custom Action
    UrlAction Tokens
    • {ListId}
    • 62. GUID representation of the list
    • 63. {SiteUrl}
    • 64. References the URL of the SPWeb context the action is called from
    • 65. {RecurrenceId}
    • 66. Unsupported in context menus (http://snipurl.com/ntcjc)
    • 67. Source URL
    • 68. This token is not available, but there is a way to get it via JavaScript, which we will see in Demo #2
    • 69. http://snipurl.com/d8zb6
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 70. Demo
    Creating a Slightly More Complex Custom Action
    View Demo: http://www.vimeo.com/9728320
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 71. Demo
    Hiding Custom Actions
    View Demo: http://www.vimeo.com/9728353
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 72. Demo
    Custom Action Groups
    View Demo: http://www.vimeo.com/9759410
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 73. Resources
    My Blog
    http://www.geoffvarosky.com
    Click on SharePoint Saturday category on left side of page
    GraceHunt.SharePointCodePlex Projects
    http://codeplex.com/GraceHunt
    John Holliday’s Custom Action Resources
    Hiding Custom Actions, and a Utility to get all custom action identifiers http://snipurl.com/d8zea
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 74. Resources
    MSDN
    Custom Action Definitions
    http://snipurl.com/d8zi7
    Default Custom Action Locations and IDs
    http://snipurl.com/d8zka
    How to: Add Custom Actions to the User Interface
    http://snipurl.com/d8zq2
    CustomAction Element
    http://snipurl.com/d9jd4
    CustomActionGroup Element
    http://snipurl.com/d9jfx
    HideCustomAction Element
    http://snipurl.com/d9jhs
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 75. Resources
    Custom Actions in SharePoint 2010
    Adding Custom Button to the SharePoint 2010 Ribbon
    http://snipurl.com/tz3vq by Jonathon Frost @ MSDN
    Adding Custom Actions to the List Item Menu in SharePoint 2010 Using SharePoint Designer 2010 http://snipurl.com/tr0t3 by Geoff Varosky
    How to Add a Tab to the Ribbon in SharePoint Foundation http://snipurl.com/tz3wi by Andrew May @ SP Dev Doc Team
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 76. Q&A
    Twitter: @gvaro
    Email: gvarosky@grace-hunt.com
    Blog: www.geoffvarosky.com
    Company: www.grace-hunt.com
  • 77. About Me
    Geoff Varosky MCP, MCTS
    Senior Solutions Developer for Grace-Hunt, LLC.
    Company: http://www.grace-hunt.com
    Blog: http://www.geoffvarosky.com
    Email: gvarosky@grace-hunt.com
    Twitter: @gvaro