Global SharePoint Users Group 1/5/10 - Creating Custom Actions Within SharePoint

1,347 views
1,288 views

Published on

Presentation on Creating Custom Actions within SharePoint given at the Global SharePoint Users Group on Janurary 5th, 2010.

Published in: Technology, Spiritual
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,347
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • stsadm -o activatefeature -name SPS.HideCustomAction -url http://spsaturday.litwareinc.com
  • Global SharePoint Users Group 1/5/10 - Creating Custom Actions Within SharePoint

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

    ×