SharePoint for ASP.Net Developers

Post on 01-Nov-2014

2,355 views 0 download

Tags:

description

The market share for SharePoint has grown in leaps and bounds over the last few years, leading to many developers being told that they are now SharePoint developers. Developing for SharePoint is a strange new world; we will cover what’s new, what’s the same, the top things that every SharePoint developer should know, and a few things to make every new developer’s life easier.

transcript

Wake up!

SharePoint for ASP.Net Developers

(It’s gonna be ok, really)

Who are you?

Me:

LiquidHub Solution ArchitectSharePoint ArchitectDeveloperFatherVirginia Tech HokieGamerWorld Famous Jungle Cruise Skipper (ret.)

SharePoint for the ASP.Net Developer

• What’s different?• What’s the same?• What tools do I need?• 10 things every SharePoint developer should

know• How to get your code rejected by your

SharePoint Architect(s)• Resources

• You get a LOT of functionality for free– Federated Search– Excel Data Services– Business Connectivity Services– Single Sign-On– Etc.

What’s different?

• You get a lot of functionality for free– Authentication/Authorization– Page Templating– Workflow hosting/reporting– Data storage

– Metadata management– Access Services– Scalable Service Hosting– Visio Workflow integration– Etc.

LOT

What’s different?

• Website Structure– Web Application → Site Collection → S.C. Root Web → Subwebs

• Deployment– Code → Assembly → Feature (usually) → Package (.WSP)

• Fea ture /ˈfitʃər/ -noun⋅1. A functional unit of SharePoint functionality, scoped at a Farm, Web

Application, Site Collection, or Web level

• Packages– First added to the server farm– Then, deployed to individual web applications (or globally)

What’s the same?

• SharePoint is an ASP.Net app– Web.config– HTTPHandlers/HTTPModules– Authentication– Master Pages– Web Parts == Composite Server Controls

• Inherit from System.Web.UI.WebControls.WebParts.WebPart

– Postbacks/Event Lifecycle Model

What tools do I need?

• Virtual Machine w/ Visual Studio, SQL Server, Active Directory, IIS, and MS Office running a server OS (64-bit for SP 2010)

• Microsoft Office SharePoint Server 2007 SDK– BDC definition editor– Workflow samples and lots more

• Microsoft SharePoint 2010 SDK– Documentation– Code samples

• SharePoint Visual Studio add-insWindows SharePoint Services 3.0 Tools: Visual Studio 2008 Extensions, Version 1.2 (VSeWSS)

WSPBuilder (for VS 2008/SP 2007 or VS/SP 2010) Visual Studio 2010 Tools for SharePoint Development (SP 2010 Only)

Add-Ins: SharePoint vs. Visual Studio

WSPBuilderSTSDev WSPBuilder

WSPBuilder Visual Studio 2010 Tools for SharePoint Development

SharePoint 2007 SharePoint 2010

VS

200

8V

S 2

010

Things every developer should know

10 Things Every SharePoint Developer Should Know

10.Whenever possible, avoid creating custom Site Definitions

10 Things Every SharePoint Developer Should Know

9. Solution packages are NOT side-by-side, versioned deployments

10 Things Every SharePoint Developer Should Know

8. Web.config changes should be made in code, not by hand

• SPWebConfigModification

10 Things Every SharePoint Developer Should Know

7. SharePoint Designer can be the enemy of performance

10 Things Every SharePoint Developer Should Know

6. Out of the box master & layout pages should never be modified

10 Things Every SharePoint Developer Should Know

5. JavaScript and Publishing Content Pages do not play well together

OK (In a Content Editor Web Part):

<script type="javascript">…</script>

Not OK (CEWP or page content):

<a href="#" onclick="javascript: …">link</a>

List data is always stripped of JavaScript

10 Things Every SharePoint Developer Should Know

4. Yes, you can have ASP.Net “yellow screen of death” callstacks on errors

In your web.config file:

1. Set mode to “off” in the customErrors element2. Set debug to “true” in the compilation element3. Set CallStack to “true” in the SafeMode element

In code!• SPWebConfigModification

10 Things Every SharePoint Developer Should Know

3. There is a right and very wrong way to iterate through a SharePoint list

OK:SPListItemsCollection items = myList.Items;for (int i = 0; i < items.Count; i++){ // loop}

Not OK:foreach (SPListItem item in myList.Items){ // loop}

10 Things Every SharePoint Developer Should Know

2. Many of the out-of-box web part classes are inheritable (but not all)

10 Things Every SharePoint Developer Should Know

1. The rules for proper disposal of SharePoint objects isn’t cut & dry – but there is help.

SPDisposeCheck

How to get your code rejected by your SharePoint Architecture Group

• Don’t dispose of your SPSite and SPWeb (and related) objects properly– The SPDisposeCheck utility is invaluable for this

• Use SPSecurity.RunWithElevatedPrivileges when unnecessary or just plain badly

• Log errors to whatever’s handy at the time• Make changes to the web.config file without

consideration for others

Resources

• SPDisposeCheck Utility– http://code.msdn.microsoft.com/SPDisposeCheck

• StackOverflow/SharePointOverflow– http://stackoverflow.com– http://sharepointoverflow.com

• Twitter (really)– RSS feed for tweets w/ SharePoint links:

http://hrl.mn/SPTweetLinks• Your local SharePoint User Group

Photo Credits• http://www.flickr.com/photos/matthewebel/4542976737/• http://www.flickr.com/photos/photojonny/2268845904/• http://www.flickr.com/photos/damaradeaella/2822846819/• http://www.flickr.com/photos/jbtaylor/5304492399/• http://www.flickr.com/photos/drsethery/5359342958/

Thanks for coming!• Don’t forget your evaluations

• You can find me at:• Blog: http://greghurlman.com• Twitter: @ghurlman• Email: greg@greghurlman.com• Princeton Area SharePoint User Group• SharePoint Saturday New York (July 30, 2011)• PAX East 2011

Questions?

One more thing…

Packers win, 24 - 21