Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
SharePoint Development For Asp Net Developers
1. SharePoint Development for ASP.NET Developers Presenter: Corey Roth Enterprise Consultant Stonebridge Blog: www.dotnetmafia.com
2. Corey Roth Consultant for Stonebridge Worked in Consumer Electronics, Travel, Advertising, and Energy industries Currently doing MOSS development specializing in Enterprise Search and ECM OSU Graduate Microsoft Award for Customer Excellence (ACE) Winner E-mail: corey.roth@gmail.com Blog: www.dotnetmafia.com (mirrored on sharepointblogs.com)
3. SharePoint 3.0 or MOSS 2007? SharePoint 3.0 (WSS) is included with Windows Server MOSS extends the features of WSS MOSS requires a separate license MOSS includes Business Data Catalog (BDC), Enterprise Seach, Excel Services, My Sites, KPI dashboards, People Search, Forms Services, etc.
4. Environment Virtualization – Windows Server, WSS or MOSS, and Visual Studio installed SharePoint on Remote Server – Requires remote debugging SharePoint on Vista – Works but not supported
5. SharePoint Basics Farm – Represents the collection of servers of the SharePoint deployment Web Applications – Typically one or more of these maps to a web site in IIS (i.e.: Port 80) Site Collection (SPSite) – Will have at least one. Groups sites together Site (SPWeb) – Represents a site or subsite in a Site Collection. Contains pages, lists, etc. Feature – Allows code and SharePoint changes to occur at the click of a button
6. What’s different about SharePoint development? Environment Deployment Pages and Sites Must deploy DLLs to GAC or use Code Access Security if deploying to bin folder User controls must be hosted by a web part
7. 12 Hive Location of most key SharePoint files: C:rogram Filesommon Filesicrosoft sharedeb Server Extensions2
9. Building a User Control with Visual Studio Web Application Project Reference Microsoft.SharePoint.dll Must be registered as safe for SharePoint to execute Typically deployed to bin folder using Code Access Security Controls are typically deployed to the CONTROLTEMPLATES folder in the 12 hive. _ControlTemplates Virtual Directory Complete instructions are on my blog
10. SafeControls SharePoint won’t execute a web part or user control unless it knows it is safe Declare an assembly and namespace safe in web.config SafeControls element Can be automated using a solution package (.wsp)
11. SharePoint API SPContext – Used to get reference to the current site or site collection All uses of SPSite or SPWeb must be disposed (use a using statement) Most collections do not have an “Exists” method Most objects require a call to .Update to save any changes made Some API calls require elevated security – Pass a delegate to RunWithElevatedPrivleges
13. Deployment Options Manually copy binaries, feature files, pages, and controls to appropriate folders on SharePoint server Create a Feature – Would still have to manually copy files Create a Solution Package (.wsp) – A cab file that contains a manfiest telling SharePoint how to deploy
14. What the Solution Package does… Backs up your web.config Changes the trust element to WSS_Custom in web.config Backs up trust configuration file – wss_minimaltrust.config becomes wss_custom_wss_minimaltrust.config Changes the path to the trust configuration file in the web.config <trustLevel> element Adds code access security settings from manifest.xml More information on my blog
16. Building and Deploying a Web Part Deploys similarly to a user control .webpart (or .dwp) file tells SharePoint where to find the web part’s code Use a feature to add the web part to the gallery Complete instructions can be found on my blog
18. Feature Receivers Feature Receivers allow you to execute code when a feature is Installed, Uninstalled, Activated, or Deactivated Create a class that inherits from SPFeatureReceiver Configured in Feature.xml SPFeatureProperties.Feature.Parent contains reference to SPWeb or SPSite object depending on scope of feature (must be cast)