sharepoint development for asp net developers

22
SharePoint Development for ASP.NET Developers Presenter: Corey Roth Enterprise Consultant Stonebridge Blog: www.dotnetmafia.com

Upload: corey-roth

Post on 29-Nov-2014

3.115 views

Category:

Technology


5 download

DESCRIPTION

Slides given for my talk about an introduction to SharePoint development at Oklahoma City Developer Group - December 2008.

TRANSCRIPT

Page 1: SharePoint Development For Asp Net Developers

SharePoint Development for ASP.NET Developers

Presenter: Corey RothEnterprise ConsultantStonebridge

Blog: www.dotnetmafia.com

Page 2: SharePoint Development For Asp Net Developers

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: [email protected] Blog: www.dotnetmafia.com (mirrored on

sharepointblogs.com)

Page 3: SharePoint Development For Asp Net Developers

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.

Page 4: SharePoint Development For Asp Net Developers

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

Page 5: SharePoint Development For Asp Net Developers

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

Page 6: SharePoint Development For Asp Net Developers

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

Page 7: SharePoint Development For Asp Net Developers

12 Hive Location of most key SharePoint files: C:\

Program Files\Common Files\microsoft shared\Web Server Extensions\12

Folder Description

CONFIGContains partial trust configuration files

ISAPIBinaries and SharePoint Web Services

LOGSError Logs (look here first when you get a strange error)

TEMPLATE\CONTROLTEMPLATES User Controls

TEMPLATE\FEATURESSharePoint Features (turns functionality on and off)

TEMPLATE\IMAGES MainImages Folder

TEMPLATE\LAYOUTS Pages and Styles

Page 8: SharePoint Development For Asp Net Developers

12 Hive (Continued)

Folder Description

TEMPLATE\SiteTemplatesDefinitions avaiable for deploying new sites

TEMPLATE\THEMESUsed to create custom themes in SharePoint

TEMPLATE\XMLContains XSDs for any XML used with SharePoint

Page 9: SharePoint Development For Asp Net Developers

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

Page 10: SharePoint Development For Asp Net Developers

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)

Page 11: SharePoint Development For Asp Net Developers

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

Page 12: SharePoint Development For Asp Net Developers

Demo

Page 13: SharePoint Development For Asp Net Developers

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

Page 14: SharePoint Development For Asp Net Developers

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

Page 15: SharePoint Development For Asp Net Developers

Demo

Page 16: SharePoint Development For Asp Net Developers

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

Page 17: SharePoint Development For Asp Net Developers

Demo

Page 18: SharePoint Development For Asp Net Developers

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)

Page 19: SharePoint Development For Asp Net Developers

Demo

Page 20: SharePoint Development For Asp Net Developers

ReferencesDot Net Mafia Bloghttp://www.dotnetmafia.com

Office SharePoint Server SDKhttp://msdn2.microsoft.com/en-us/library/ms550992.aspx

STSDevhttp://www.codeplex.com/stsdev

SharePoint Blogshttp://www.sharepointblogs.com

Page 21: SharePoint Development For Asp Net Developers

Questions?