SharePoint Custom Field Controls

  • 15,231 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • Can you provided a downloadable version of this PPT?
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
15,231
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
1
Likes
8

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

Transcript

  • 1. Custom Field Controls and SharePoint Web Content Management
    Chakkaradeep Chandran
    Robert Stewart
  • 2. Session Overview
    • SharePoint artefacts and Web Content Management
    • 3. Intergen – “powered by Microsoft Office SharePoint” Demo
    • 4. Role of Content Types, Site Columns in a Publishing Site
    • 5. Custom Field Types
    • 6. Web Parts Vs Field Controls as content regions
    • 7. Custom field type development topics
  • SharePoint and WCM
    • SharePoint provides Web Content Management (WCM) functionality out of the box
    • 8. WCM features are provided primarily by the Publishing Site feature
    • 9. Several standard SharePoint components work together to provide WCM functionality
    • 10. Key Components of a Publishing Site
    • 11. Site Columns
    • 12. Content Types
    • 13. Field Controls
    • 14. Page Layouts
    • 15. Document Libraries
    • 16. Lists
  • Demo
    Intergen “powered by Microsoft Office SharePoint” demo
  • 17. Page Layouts, Content Types, Site Columns
    GeneralPage Content Type
    Title
    Title
    Description
    Page Content
    Page Image
    Vincent van Gogh
    Gogh was a Dutch Post-Impressionist artist who live in the 1800s.
    Van Gogh spent his early adult life working for a firm of art dealers. After a brief spell as a teacher, he became a missionary worker in a very poor mining region. He did not embark upon a career as an artist until 1880.
    Vincent van Gogh
    Gogh was a Dutch Post-Impressionist artist who live in the 1800s.
    Van Gogh spent his early adult life working for a firm of art dealers. After a brief spell as a teacher, he became a missionary worker in a very poor mining region. He did not embark upon a career as an artist until 1880.
    Description
    Page Content
    Page Image
    GeneralPageLayout.aspx
  • 18. Custom Field Types
    • SharePoint and WSS include many field types
    • 19. Text
    • 20. Choice Fields
    • 21. Hyperlink or Picture
    • 22. Publishing HTML
    • 23. Create custom field types to satisfy requirements not met by out of the box field types
    • 24. Field Type == Data Type
    • 25. Field type provide field rendering facilities
    • 26. Field controls are tightly coupled with the type of the field
    • 27. Field controls deliver or capture the content in a Publishing Page
  • Web Parts Vs Field Controls
    • Both allow you to add content regions to a page layout
    • 28. Rule of thumb:
    • 29. Use field controls for content and Web Parts for functionality
    • 30. Since a field control is bound to a specific field of an item, it offers complete versioning/history
    • 31. Web Parts do not offer complete versioning/history
  • Demo
    Custom Field Control - Components
  • 32. Development Components
    Demo
    {.......}
    {....}
  • 33. Demo
    Field Control – Rendering Template &
    Rendering Control
  • 34. Field Control – Rendering Template
    Demo
    Rendering Template
    Edit Mode
    Display Mode
  • 35. Field Control – Rendering Control
    Demo
    Edit Mode
    Display Mode
    • Every rendering control has at least one rendering template associated with it
    • 36. A RenderingTemplate object is defined as a RenderingTemplate element in an .ascx file
    • 37. The rendering template is referenced by its ID value in the rendering control object's TemplateName property
  • Rendering Control – BaseFieldControl
    Demo
    Edit Mode
    Display Mode
  • 38. Rendering Control – CreateChildControls
    Demo
    Edit Mode
    Display Mode
  • 39. Demo
    InPagePod Field – Rendering Template & Rendering Control
  • 40. Field Control – Summary
    Demo
    Rendering Template
    Rendering Control
    Naming Convention - field_type_nameFieldControl
    Edit Mode
    Display Mode
    The Rendering Template is referenced by its ID value in the Rendering Control object's TemplateName property
    BaseFieldControl-derived rendering control handles interaction with users
    Its plain simple HTML/ASCX code
  • 41. Demo
    Field Class
  • 42. Field Class
    Demo
    • This is a class whose instances can represent particular fields that are based on your custom field type
    • 43. This class must inherit from SPField or one of the classes in Windows SharePoint Services that derive from it
  • Demo
    InPagePod Field – Field Class
  • 44. Field Class – Summary
    Demo
    Naming Convention - field_type_nameField
    Field class should inherit either SPField or one of the various other SPField classes
    InPagePod inherits from SPFieldMultiColumn
    Override the FieldRenderingControlproperty which returns the control that can be used to render the field in Edit and Display mode
    Field Class object handles interactions with the content database
  • 45. Demo
    Field Value
  • 46. Field Value
    Demo
    String Value
    (Or)
    titleImgUrl;podContent;contentImageUrl
    Custom Value Class
    SPFieldMultiColumnSPFieldMultiColumnValue
    SPFieldUrl
    SPFieldUrlValue
    ;#TitleImage;#PodContent;#ContentImage;#
  • 47. Field Value – Saving Field Values
    Demo
  • 48. Demo
    InPagePod Field – Field Value
  • 49. Field Value– Summary
    Demo
    Naming Convention - field_type_nameFieldValue
    String Value
    Custom Value Class
    A custom field value class must implement at least two constructors, and usually only two
    SharePoint delimiter - ;#
  • 50. Demo
    Field Validation
  • 51. Field Validation
    Demo
    (when the Publishing
    Page is validated)
    (before committing to
    the content database)
  • 52. Validate When Saving Field Values
    Demo
  • 53. Overriding Validate Method
    Demo
    ;#TitleImage;#PodContent;#ContentImage;#
  • 54. Overriding GetValidatedString Method
    Demo
    ;#TitleImage;#PodContent;#ContentImage;#
  • 55. Demo
    InPagePod Field – Field Validation
  • 56. Field Validation – Summary
    Demo
    Validate the control values before setting the field values in the Field Control class
    Set the IsValidto false
    Set the ErrorMessageto an appropriate error message
    Override the Validate method in the Field Control class
    Set the IsValidto false
    Set the ErrorMessageto an appropriate error message
    Override the GetValidatedString in the Field class
    Throw SPFieldValidationException as an error
  • 57. Demo
    Field Type Definition
  • 58. Field Type Definition
    Demo
    fldtypes_spconf.xml
    fldtypes*.xml
  • 59. Demo
    InPagePod Field – Field Type Definition
  • 60. Demo
    Custom Field Type Deployment
  • 61. Custom Field – Deployment
    Demo
    *.ascx
    Rendering Template
    12TEMPLATECONTROLTEMPLATES
    Rendering Control Class
    *.cs (.dll)
    Field Control Class
    fldtypes*.xml
    GAC
    Field Class
    Field Value Class
    Field Type Definition
    12TEMPLATEXML
    *.WSP
  • 62. Custom Field – Usage
    Demo
  • 63. Session Summary
    Demo
    *.WSP
  • 64. Resources
    Demo
    Web Content Management Resource Center for SharePoint Server
    http://bit.ly/moss-wcm
    SharePoint Server Developer Center
    http://bit.ly/moss-dev
    MSDN: How to Create a Custom Field Control
    http://bit.ly/custom-field-control
    Chaks’ Blog
    http://bit.ly/chaks
    Robert Stewart’s Blog
    http://bit.ly/robert-stewart
  • 65. Thank You
    chaks@intergen.co.nz
    robs@intergen.co.nz