HOME EVIDENCE EXECUTION MICROSOFT SOLUTIONS SERVICES PARTNERS Custom Field Controls and SharePoint...
-
Upload
willis-job-adams -
Category
Documents
-
view
214 -
download
0
Transcript of HOME EVIDENCE EXECUTION MICROSOFT SOLUTIONS SERVICES PARTNERS Custom Field Controls and SharePoint...
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Custom Field Controls and SharePoint Web Content Management
Chakkaradeep Chandran Robert Stewart
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Intergen – “powered by Microsoft Office SharePoint” Demo
The relationship between page layouts, content types and site columns in Publishing Sites
The role of Content Types in a Publishing Site Custom Field Types Web Parts Vs Field Controls as content regions Custom field type development topics
Session Objectives
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Demo
Intergen “powered by Microsoft Office SharePoint” demo
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
SharePoint provides Web Content Management (WCM) functionality out of the box
WCM features are provided primarily by the Publishing Site feature Several standard SharePoint components work together to provide WCM
functionality Key Components of a Publishing Site
Site Columns Content Types Field Controls Page Layouts Document Libraries Lists
SharePoint and WCM
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
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…
PortraitOne.jpg
Title
Description
Page Content
Page Image
Vincent van GoghGogh 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 GoghGogh 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.
GeneralPage Content Type
Title
Description
Page Content
Page Image
GeneralPageLayout.aspx
Page Layouts, Content Types, Site Columns
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Custom Field Types
SharePoint and WSS include many field types Text Choice Fields Hyperlink or Picture Publishing HTML
Field Type == Data Type Create custom field types to satisfy requirements not met by out of the box
field types Field types also provide field rendering facilities Field controls deliver or capture the content in a Publishing Page Field controls are tightly coupled with the type of the field
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Web Parts Vs Field Types
Both allow you to add content regions to a page layout Rule of thumb:
Use field controls for content and Web Parts for functionality Since a field control is bound to a specific field of an item, it offers complete
versioning/history Web Parts do not offer complete versioning/history
Field Controls Web Parts
Personalization No Yes
Storage Content is stored in a field in page’s underlying list
Content is stored with and/or managed by Web Part
Suggested Use Atomic content rendering and editing
Functionality
Versioning Complete history No history
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Custom Field
Field Control
Rendering Template
Rendering Control
Field Class
SPFieldMultiChoice
SPFieldMultiColumn
Field Value
SPFieldMultiColumnV
alue
SPFieldMultiChoiceVa
lue
Field Type Definition
fldtypes_<name>.xml
{.......}
{....}
DemoDevelopment Components
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Field Control – Rendering Template &
Rendering Control
Demo
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Field Control – Rendering Template
Edit Mode Display ModeRendering Template
Demo
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Field Control – Rendering Control
Edit Mode Display Mode
Every rendering control has at least one rendering template associated with it
A RenderingTemplate object is defined as a RenderingTemplate element in an .ascx file
The rendering template is referenced by its ID value in the rendering control object's TemplateName
property
Demo
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Rendering Control – BaseFieldControl Demo
Edit Mode Display Mode
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Rendering Control – CreateChildControls Demo
Edit Mode Display Mode
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Demo
InPagePod Field – Rendering Template & Rendering Control
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
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
Field Control – Summary Demo
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Field Class
SPFieldBoolean
SPFieldChoice
SPFieldCurrency
SPFieldLookup
SPFieldMultiColumn
SPFieldMultiChoice
SPFieldMultiLineText
SPFieldNumber
SPFieldRatingScale
SPFieldText
SPFieldUrl
SPFieldUser
This is a class whose instances can represent particular fields that are based on your custom field type
This class must inherit from SPField or one of the classes in Windows SharePoint Services that derive
from it
Demo
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
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 FieldRenderingControl method 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
Field Class – Summary Demo
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Field Value
titleImgUrl;podContent;contentImageUrl
String Value
Custom Value Class
;#TitleImage;#PodContent;#ContentImage;#
Demo
(Or)
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
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 - ;#
Field Value– Summary Demo
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Field Validation Demo
Field Validation
Rendering Control
When Saving Field Values
Override Validate Method
Field Class
Override GetValidatedString Method
(before committing to the content database)
(before saving the Publishing page)
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Overriding Validate Method Demo
;#TitleImage;#PodContent;#ContentImage;#
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Overriding GetValidatedString Method Demo
;#TitleImage;#PodContent;#ContentImage;#
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Validate the control values before setting the field values in the Field Control class Set the IsValid to true Set the ErrorMessage to an appropriate error message
Override the Validate method in the Field Control class Set the IsValid to true Set the ErrorMessage to an appropriate error message
Override the GetValidatedString in the Field class Throw SPFieldValidationException as an error
Field Validation – Summary Demo
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Field Type Definition Demo
fldtypes*.xml fldtypes_spconf.xml
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Demo
InPagePod Field – Field Type Definition
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Custom Field – Deployment Demo
*.ascx
*.cs (.dll)
fldtypes*.xml
Rendering Template
Rendering Control Class
Field Control Class
Field Class
Field Value Class
Field Type Definition
*.WSP
12\TEMPLATE\CONTROLTEMPLATES\
GAC
12\TEMPLATE\XML\
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
Session Summary Demo
*.WSP
SPFieldBoolean
SPFieldChoice
SPFieldCurrency
SPFieldLookup
SPFieldMultiColumn
SPFieldMultiChoice............
HOME EVIDENCE
EXECUTION MICROSOFT SOLUTIONSSERVICESPARTNERS
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
Resources Demo