1 / 25

SharePoint Development 101: Feature Design

SharePoint Development 101: Feature Design. By Becky Isserman http://www.mosslover.com. SharePoint Development vs. ASP .Net Development. User Controls Features. Build a User Control using the SharePoint Object Model. Demo. What is a Feature?.

feivel
Télécharger la présentation

SharePoint Development 101: Feature Design

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. SharePoint Development 101: Feature Design By Becky Isserman http://www.mosslover.com

  2. SharePoint Development vs. ASP .Net Development • User Controls • Features

  3. Build a User Control using the SharePoint Object Model Demo

  4. What is a Feature? • Re-usable solutions on the farm, web application, site collection (site), and site (web) level • Have endless possibilities for use… • Requires a Feature.xml (feature definition file) • Can have an Elements.xml or more • Are stored in 12\template\features

  5. Answer: 137 Question: How many features are installed in SharePoint out of the box?

  6. Feature Definition (feature.xml) • Includes: • Elements Attributes • Activation Dependencies • Feature Elements (included in elements.xml files)

  7. Element Attributes

  8. Feature Definition Example <Feature Title = “My Feature” Scope = “Web” Id=“235A5BAD-7D97-435C A2DB-AB579CAD79BC” Version = “2.3.1.2” xmlns = “http://schemas.microsoft.com/sharepoint”> <ElementManifests> <ElementManifest Location=“Elements.xml” /> </ElementManifests> </Feature> Bonus: What do these attributes mean?

  9. Activation Dependencies • Definition: Requirement in the relationship between two features • Can be on the same scope or cross-scope • Between two separate scope • i.e. Web to Site, Site to Web Application, or Web Application to Farm • Used to guarantee resources or group features together

  10. The Team Collaboration Site Definition Activates 19 features can you name some of them?

  11. Feature Elements (everything in the element.xml files)

  12. Feature Receivers • FeatureInstalled • FeatureUninstalling • FeatureActivated • FeatureDeactivating • Good Reference STSDEV Video with Ted Pattison

  13. Create a Feature using STSDev Demo

  14. Solution Package • Feature.xml and Elements.xml files • Manifest.xml • GUID • Tells feature if it should be deployed on WFE’s, Application Server, etc… • Lists Safe Controls • Diamond Directive File (ddf) • Place to include files and directories for solution package • .Set DestinationDir=Directory • To manually create Feature Package (wsp file):MakeCab.exe /F DeploymentFiles\Test.ddf /D CabinetNameTemplate=Feature.wsp /D DiskDirectory1=wsp

  15. Solution Package • Dynamically create a feature package by creating Test.targets file • Add some xml to point to MakeCab.exe and add command shell • Right click on the solution in Solution Explorer and select “Unload Project” • Right click the project name in solution explorer and select Edit [project name].csproj • Add to end: <Import Project = “DeploymentFiles\Test.targets” /> • Delete all commented xml, but <Target Name=“AfterBuild”></Target> • Add:<Target Name = “AfterBuild”><CallTarget Targets = “Test” /></Target> • Save Changes and Right Click on the project name and choose “Load” (you may see a warning dialog box, ignore it)

  16. Manual Installation and Activation • All Features must be installed before they can be activated • All features must be deactivated before they can be uninstalled, unless scope is farm or web app

  17. Manual Installation and Activation stsadm.exe –o installfeature{-filename <relative path to Feature.xml> | -name <feature folder>} [-force] stsadm.exe –o uninstallfeature {-filename <relative path to Feature.xml> | -name <feature folder> | -id <feature Id>} [-force] stsadm.exe –o activatefeature {-filename <relative path to Feature.xml> | -id <feature id>} [-url <url>] [-force] stsadm.exe –o deactivatefeature {-filename <relative path to Feature.xml> | -id <feature id>} [-url <url>] [-force]

  18. Activation Areas & STSADM Demo Demo

  19. Feature Disadvantages • Before STSDev you had to manually create the manifest, ddf files, feature.xml, elements.xml, solution installer, etc… • Deactivating and retracting features leave artifacts • Not all lists, content types, and columns leave when the feature is turned off • Can still remove items manually • Some people do not like coding only in xml • XML intellisense was just added in the new SDK for SharePoint • There is no debugger • There is no pretty design interface

  20. Feature Advantages • Easy to deploy in multiple environments and sites • Creates items as un-customized • i.e. master pages can reside in one place and include 3 references, rather than normally where SharePoint Designer creates 3 separate master pages • Can control site columns and content types • Harder to track if created individually in user interface • Overall a lot of time is saved, which equals $$

  21. Tools • STSDev • http://www.codeplex.com/stsdev • VSEWSS 1.1 (Visual Studio Extensions for Windows SharePoint Services) • http://www.microsoft.com/downloads/details.aspx?FamilyID=3e1dcccd-1cca-433a-bb4d-97b96bf7ab63&displaylang=en • Andrew Connell CodeRush/Refactor Tool for Developershttp://www.andrewconnell.com/blog/articles/ProductivityToolsForSharePointDevelopers.aspx • SharePoint for Developer's Part 1: http://msdn.microsoft.com/en-us/rampup/dd221355.aspx

  22. References • Professional SharePoint 2007 Developmentby John Holliday, et al. pages 138-158 • Microsoft SharePoint Server 2007 Bible by Wynne Leon, et al. pages 255-283 • Real World SharePoint 2007 b Scot Hillier, et al. pages 96-111 • Professional SharePoint 2007 Web Content Management Development by Andrew Connell pages 63-67

  23. Questions? Comments?

  24. Contact Information • Blog: http://www.mosslover.com • E-Mail: rebecca.isserman@gmail.com • SharePoint Comic: http://www.sharepointcomic.com • Kansas City Office Geeks Site: http://www.officegeeks.org/kcog

More Related