1 / 30

Minneapolis Office Developer Interest Group (MODIG)

Minneapolis Office Developer Interest Group (MODIG). Neil Iversen Inetium. March 25, 2008 Custom Column Development. http://justaddcode.com/. The Plan. Introduction  You are here Feature Presentation Custom Columns Next Topic Selection Random Stuff. User Group Goals.

Download Presentation

Minneapolis Office Developer Interest Group (MODIG)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Minneapolis Office Developer Interest Group (MODIG) Neil Iversen Inetium March 25, 2008 Custom Column Development http://justaddcode.com/

  2. The Plan • Introduction  You are here • Feature Presentation • Custom Columns • Next Topic Selection • Random Stuff

  3. User Group Goals • Provide a community for SharePoint Developers • Share development knowledge • Exchange tips/tricks/other/free pizza • Know that SPSimpleFormattingEncodedResourceExpressionBuilder is the longest Object Model Class Name

  4. User Group Format • Presentations • 1-2 per meeting • Hopefully Demo Heavy (Slides are for MBAs) • Highlights of Nifty Things • See next slide • QA/Discussion/Random Things

  5. Call for Cool Stuff • Created something cool? • Send Screenshots or Videos • We’ll try to feature some items here

  6. Sharepointmn.com/modig/ • Our current home • Meeting information • Usually has the right time • Previous presentations • Running on SharePoint • As required by SharePoint User Group Law

  7. Upcoming • Next Meeting • April 17 (5:30pm) • Topic: TBD – Hopefully later today • MNSPUG • April 9 (9:00am – Noon) • Topic : TBD (sharepointmn.com)

  8. Custom Fields – A Code Heavy Approach • Custom Column Intro • Basic Column Development • Deploying Columns • Developing Fancier Columns • Questions

  9. Custom Fields/Columns/Types • No Matter What you Call It • They’re fun! • Create for Special Purposes • Complex Data • Increased Validation • Prettier UI

  10. Custom Fields/Columns/Types • Derived From SPField • SPFieldText • SPFieldNumber • SPFieldMultiChoice • … • UI Derived From BaseControlTemplate • XML Defined • 12\TEMPLATE\XML • Core Fields are in FLDTYPES.XML

  11. Custom Fields Schema <?xml version="1.0" encoding="utf-8" ?> <FieldTypes> <FieldType> <Field Name="TypeName">Data Field - Just Add Code</Field> <Field Name="ParentType">MultiChoice</Field> <Field Name="TypeDisplayName">Data Field - Just Add Code</Field> <Field Name="TypeShortDescription">A Practical Custom Field</Field> <Field Name="FieldTypeClass">MODIG0803.Fields.DataField, MODIG0803.Fields, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1c0d2e6ac5478941</Field> <Field Name="UserCreatable">TRUE</Field> </FieldType> </FieldTypes>

  12. Deploying A Field • DLLs • Installed into the GAC • FLDTYPE • 12\TEMPLATE\XML\ • iisreset • Cross Fingers • It never hurts

  13. Demo – Our First Field

  14. Advanced Custom Fields Schema <?xml version="1.0" encoding="utf-8" ?> <FieldTypes> <FieldType> <Field Name="TypeName">Data Field - Just Add Code</Field> <Field Name="ParentType">MultiChoice</Field> <Field Name="TypeDisplayName">Data Field - Just Add Code</Field> <Field Name="TypeShortDescription">A Practical Custom Field</Field> <Field Name="FieldTypeClass">MODIG0803.Fields.DataField, MODIG0803.Fields, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1c0d2e6ac5478941</Field> <Field Name="UserCreatable">TRUE</Field> <PropertySchema> <Fields> <Field Name="Another Field" DisplayName="Another Field I can See" ShowInNewForm="TRUE" ShowInEditForm="TRUE" Type=“Number" Hidden="FALSE"> </Field> </Fields> </PropertySchema> </FieldType> </FieldTypes>

  15. Demo – More Advanced Schema

  16. Advanced Custom Fields Schema <?xml version="1.0" encoding="utf-8" ?> <FieldTypes> <FieldType> <Field Name="TypeName">Data Field - Just Add Code</Field> <Field Name="ParentType">MultiChoice</Field> <Field Name="TypeDisplayName">Data Field - Just Add Code</Field> <Field Name="TypeShortDescription">A Practical Custom Field</Field> <Field Name="FieldTypeClass">MODIG0803.Fields.DataField, MODIG0803.Fields, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1c0d2e6ac5478941</Field> <Field Name="UserCreatable">TRUE</Field> <RenderPattern Name="DisplayPattern"> <HTML><![CDATA[Help, I'm <b>]]></HTML> <Column HTMLEncode="TRUE" /> <HTML><![CDATA[</b>Surrounded!]]></HTML> </RenderPattern> </FieldType> </FieldTypes>

  17. Render Patterns • HeaderPattern – Column Title • DisplayPattern – List Item View • EditPattern – Edit Form View • NewPattern – New Form View • PreviewDisplayPattern • PreviewEditPattern • PreviewNewPattern

  18. Demo – More Advanced Schema

  19. Control State Sequence • Field Is Loaded • GetFieldValue - Restored from ‘Serialized’ state • Field Rendering Control is Loaded • .Value is SET • Control Mode Property • Tied to action against ListItem • SPControlMode • Display, Edit, New, Invalid • Value is retrived via GET • GetValidatedString

  20. DEMO – What does that Look Like?

  21. Custom Validation – Server Side • Override GetValidatedString(Object value) • Final Call in Field Setting Lifecycle • Called during most Save’s • Ex: SPListItem.Properties[“MyValue”] • Not Always Called • Web Services • RPC • DataSheets • Proper Validation Error: SPFieldValidationException • Can be used to ‘set’ the final value

  22. DEMO – Odd Validation

  23. Field Validation – UI Side • Override Validate() • Set the IsValid property • ErrorMessage to the text of the Error • SDK Example: if (Field.Required && (Value == null || Value.ToString().Length == 0)) { this.ErrorMessage= Field.Title + " must have a value." IsValid= false; return; }

  24. DEMO – Odd Validation

  25. Adding Useful Features • CONTROLTEMPLATES • ASCX File for a Field • Data Access Code Behind • Pull in and validate data against external Systems • Expand UI Functionality • AJAX.NET • Silverlight(http://www.ssblueprints.net/sharepoint/)

  26. DEMO - Lets get (or fake) some Data!

  27. Summary • Fields are Fun • Difficult Learning Curve • State Management is Key • Validation is Two Fold • Field Level Validation • UI Level Validation • Neither always run • EventReciever for True Validation

  28. Questions?

  29. Next Meeting Planning • Possible Topics • PowerShell and SharePoint for Developers • Using the MS AJAX Framework in SharePoint • Managing Context in SharePoint • Introduction to Workflow • Silverlight 2 and SharePoint • …

  30. Random Stuff Neil Iversen Inetium http://justaddcode.com Feedback Forms/Giveaway Mingle, Eat, Feedback See you next time!

More Related