Presentation is loading. Please wait.

Presentation is loading. Please wait.

SharePoint Development 101: Feature Design By Becky Isserman

Similar presentations


Presentation on theme: "SharePoint Development 101: Feature Design By Becky Isserman"— 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 DEMO Build a User Control using the SharePoint Object Model

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 QUESTION: HOW MANY FEATURES ARE INSTALLED IN SHAREPOINT OUT OF THE BOX? Answer: 137

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

7 Element Attributes NameTypeDescriptionDefaultRequired ScopeTextFarm, Web Application, Site, WebNoneYes IdTextGuid, can be generated in GUIDGen.exe tool in Visual Studio 2005 NoneYes TitleTextTitle of featureNoneNo DescriptionTextDescription of featureNoneNo HiddenBooleanAbility for users to see featureFalseNo VersionTextVersion Number (i.e. 1.0.0.0)NoneNo ImageUrlTextImage for feature in activation areaNoneNo ImageUrlAltTextTextAlternate image textNoneNo

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”> 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? AnnouncementsListGanttTasksListTasksList ContactsListGridListWebPageLibrary CustomListIssuesListWorkflowProcessLibrary DataSourceLibraryLinksListWorkflowHistoryList DiscussionsListNoCodeWorkflowLibraryXmlFormLibrary DocumentLibraryPictureLibrary EventsListSurveysList

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

12 NameScopeDescription Content TypeSiteDefines a custom content type when activated (templates, etc.) Content Type BindingSiteCan define a content type included in the onet.xml ControlAllCan replace any ascx control (i.e. search controls, etc…) Custom ActionAllCan add various actions (toolbar, menu, site settings…) Custom Action GroupAllGroup of custom actions Document ConvertorFarm, Web App Site Converts a document to a copy of itself in a different file format Feature/Site Template Association Farm, Web App, Site Binds features with a site definition, so all sites with that definition use the feature when created (most of the Fantastic 40 use this element) FieldSiteCreates a site column for use in any list List InstanceSite, WebCreates a list of the type defined List TemplateSite, WebAllows the use of a custom list template ModuleSite, WebList of files to support the feature ReceiverAllRegisters an event receiver for an item WorkflowSiteContains the definition for a workflow

13 Feature Receivers FeatureInstalled FeatureUninstalling FeatureActivated FeatureDeactivating Good Reference STSDEV Video with Ted Pattison

14 DEMO Create a Feature using STSDev

15 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

16 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: –Delete all commented xml, but –Add: –Save Changes and Right Click on the project name and choose “Load” (you may see a warning dialog box, ignore it)

17 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

18 Manual Installation and Activation stsadm.exe –o installfeature {-filename | -name } [-force] stsadm.exe –o uninstallfeature {-filename | -name | -id } [-force] stsadm.exe –o activatefeature {-filename | -id } [-url ] [-force] stsadm.exe –o deactivatefeature {-filename | -id } [-url ] [-force]

19 DEMO Activation Areas & STSADM Demo

20 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

21 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 $$

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

23 References Professional SharePoint 2007 Development by 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

24 QUESTIONS? COMMENTS?

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


Download ppt "SharePoint Development 101: Feature Design By Becky Isserman"

Similar presentations


Ads by Google