SharePoint Saturday Baltimore 7/25/09 - Introduction To Developing Custom Actions Within SharePoint

1,337 views

Published on

Updated presentation from my SharePoint Saturday Boston session - "Introduction to Developing Custom Actions within SharePoint"

Published in: Technology, Business
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,337
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide
  • Thank you for your time today.<Introductions>
  • Hidden=trueActivate and deactivate via CMD line – why? You do not want site admins, who you are hiding this from, to be able to deactivate the feature to delete the site!stsadm -o activatefeature -name SPS.HideCustomAction -url http://spsaturday.litwareinc.com
  • Record questions – post answers on my blog following SharePoint Saturday
  • SharePoint Saturday Baltimore 7/25/09 - Introduction To Developing Custom Actions Within SharePoint

    1. 1. Introduction to Developing Custom Actions within 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 Staff<br />Microsoft Gold Partner<br />Specializing in SharePoint and Dynamics (CRM, SL, GP, NAV)<br />Web: http://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 />
    5. 5. 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 />
    6. 6. 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 />
    7. 7. 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, etc.) document types<br />
    8. 8. 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 />
    9. 9. What Can Custom Actions Do?<br />Examples of Custom Actions<br />Edit Control Block (ECB Menu)<br />Toolbars<br />Site Actions Menu<br />Site Settings Page<br />Central Administration Pages<br />Operations, Application Management<br />Shared Service Provider Pages<br />You get the idea…<br />(hopefully?)<br />
    10. 10. Examples<br />Toolbars<br />
    11. 11. Examples<br />Site Actions Menu<br />
    12. 12. Examples<br />Site Settings<br />
    13. 13. Examples<br />Site Settings (Custom Action Group)<br />
    14. 14. Examples<br />Edit Control Block (ECB)<br />
    15. 15. Examples<br />Central Administration Pages<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. (Why? Who knows…) Never fear though – you can add one easily (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 />
    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 />
    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 />
    19. 19. Demo<br />Creating a Simple <br />Custom Action <br />
    20. 20. Anatomy of a Custom Action<br />Feature Definition (feature.xml)<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></li></ul><li>Anatomy of a Custom Action<br />Element Manifest (manifest.xml)<br />
    31. 31. 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 />
    32. 32. Anatomy of a Custom Action<br />Id (optional)<br /><ul><li>Specifies a unique identifier for custom action
    33. 33. May be a GUID or a unique term
    34. 34. Example:DeleteWeb</li></ul>GroupID(optional)<br /><ul><li>Identifies the unique group that this element is contained in
    35. 35. Example:SiteAdministration</li></li></ul><li>Anatomy of a Custom Action<br />Location (optional)<br /><ul><li>Specifies the location for this custom action
    36. 36. 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
    37. 37. Example: List</li></li></ul><li>Anatomy of a Custom Action<br />RegistrationId(optional)<br /><ul><li>Specifies the registration attachment for a per-item action
    38. 38. Example (List Identifier – Task List): 107 (http://snipurl.com/ntd5g)</li></ul>Title (required)<br /><ul><li>Specifies the name of your action
    39. 39. 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></li></ul><li>Anatomy of a Custom Action<br />Sequence (optional)<br /><ul><li>The order in which your action will appear.
    40. 40. If not specified, displayed in the order it is read by SharePoint by Feature and by order in element listing (XML).</li></li></ul><li>Anatomy of a Custom Action<br />Permissions<br /><ul><li>RequireSiteAdministrator (optional)
    41. 41. Boolean (True or False)
    42. 42. Cannot be used on ECB menu list items
    43. 43. Rights
    44. 44. Specify rights needed for this Custom Action to be visible
    45. 45. Example: “ApproveItems,DeleteListItems”
    46. 46. Possible Values http://snipurl.com/ntcz5</li></li></ul><li>Anatomy of a Custom Action<br />UrlAction Tokens<br /><ul><li>~site
    47. 47. References the current SPWeb context
    48. 48. ~sitecollection
    49. 49. References the current SPSite context
    50. 50. {ItemId}
    51. 51. GUID of the item action is called from
    52. 52. {ItemUrl}
    53. 53. URL of the item the action is called from</li></li></ul><li>Anatomy of a Custom Action<br />UrlAction Tokens<br /><ul><li>{ListId}
    54. 54. GUID representation of the list
    55. 55. {SiteUrl}
    56. 56. References the URL of the SPWeb context the action is called from
    57. 57. {RecurrenceId}
    58. 58. Unsupported in context menus (http://snipurl.com/ntcjc)
    59. 59. Source URL
    60. 60. This token is not available, but there is a way to get it via JavaScript, which we will see in Demo #2
    61. 61. http://snipurl.com/d8zb6</li></li></ul><li>Demo<br />Creating a Slightly More Complex Custom Action <br />
    62. 62. Demo<br />Hiding Custom Actions<br />
    63. 63. Demo<br />Custom Action Groups<br />
    64. 64. 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 />
    65. 65. 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 />
    66. 66. Q&A<br />
    67. 67. 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 />

    ×