![Page 1: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/1.jpg)
Just Freakin’ Work!Avoiding Common Hurdles in SharePoint
Development
Geoff VaroskyMark Rackley
![Page 2: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/2.jpg)
About the speakers…
The HillbillyMr. Ackley
Catcher of all things that flow downhillSolutions Architect for Juniper Strategy, LLC.
www.juniper-strategy.com
Speaker, Blogger, (soon to be) AuthorBlog: www.sharepointhillbilly.comTwitter: @mrackleyE-mail: [email protected]
![Page 3: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/3.jpg)
About the speakers…
The YankeeGeoff Varosky
MCP, MCTS
Senior Solutions Developer for Grace-Hunt, LLC.
www.grace-hunt.com
Speaker, Blogger, (soon to be) AuthorBlog: www.sharepointyankee.comTwitter: @gvaroE-mail: [email protected]
![Page 4: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/4.jpg)
You might be a SharePoint Developer if…
![Page 5: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/5.jpg)
Agenda
IntroductionDevelopmentDeploymentResourcesQ&A
![Page 6: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/6.jpg)
Introduction
Types of DevelopmentDevelopment ToolsDevelopment EnvironmentDeveloping to Deploy
![Page 7: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/7.jpg)
Introduction
Types of DevelopmentUnmanaged CodeManaged CodeCustomization
![Page 8: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/8.jpg)
Introduction
Development ToolsSTSDEV (2007)
stsdev.codeplex.com
WSPBuilder (2007 & 2010)wspbuilder.codeplex.com
CKS:DEV (2010)cksdev.codeplex.com
SharePoint Designer
![Page 9: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/9.jpg)
Introduction
Development EnvironmentPhysical?Virtual?Desktop?Dusty old PC under the desk?
![Page 10: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/10.jpg)
Introduction
2007 or 201064-bit (leaves room for upgrade)>= 4G of RAMChoice of Virtual Host
HyperV, VMWare, VirtualBoxNot much in the way of VirtualPC support
Create a base virtual imageSQL, Base SP install, Service Packs, Dev ToolsVisual Studio, SPD, etc.
![Page 11: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/11.jpg)
Introduction
Development EnvironmentFollow the SDK (2010)
64 bitDesktop
Windows 7Vista (SP1+)Http://msdn.microsoft.com/en-us/library/ee554869.aspx
Server 2008
![Page 12: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/12.jpg)
Introduction
Development EnvironmentMake sure your environment matches deployment targets!
In Visual StudioCPU
x86? x64? AnyCPU?
.NET FrameworkService PacksSame architecture
![Page 13: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/13.jpg)
Introduction
Development EnvironmentDon’t do everything as local admin!
Follow proper account configuration from the SDK
Developing to DeployUse the least amount of privileges
This will make admins happy
Web application deployment (/bin)CAS policies
![Page 14: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/14.jpg)
Development
General Development PracticesListsEvent ReceiversWeb PartsUnmanaged CodeWeb Services
![Page 15: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/15.jpg)
Development
General Development PracticesDispose of Objects!
SPDisposeCheck
Test with multiple accounts/privilegesStrongly named assembliesSeparate high and low privileged DLLsDo not mix .NET Framework versions64 bit code compatibility
![Page 16: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/16.jpg)
Development
General Development PracticesStay away from the database
USE THE API!
Use resource & language filesDo not hard code strings and labels
Caching when and where possiblemsdn.microsoft.com/library/bb687949.aspx
CAS PoliciesSafe Controls
![Page 17: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/17.jpg)
Development
General Development PracticesUse try{} catch{} finally{} blocksCheck for nulls in finally{} blocks with disposable objects before disposing
Change defaultsAssembly Info
Name it properlyGraceHunt.SharePoint.WebParts.Stuff
![Page 18: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/18.jpg)
Development
General Development PracticesSign Controls
Do not password protect the SNK
Elevating PrivilegesSPSecurity.RunWithElevatedPrivileges()
Clean, Validated, Secure dataRuns as System accountWrite operations?
Preceeded by SPUtility|SPWeb.ValidateFormDigestMust use new SPSite or SPWeb – not SPContext.Current
![Page 19: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/19.jpg)
You might be a SharePoint Developer if…
![Page 20: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/20.jpg)
Development
ListsTest queries before deployment!U2U CAML Query Builder
Remove the <Query></Query> tags!
http://www.spsprofessional.com/sqlcaml.aspxLINQBatch queries when possible
![Page 21: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/21.jpg)
Development
ListsDo not use SPList.Items
Use SPList.GetItems(query)Paginate (2000 items) – RowLimit
GetItemByIDUse SPList.GetitemByIDNot SPList.Items.GetItemByID
![Page 22: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/22.jpg)
Development
Event HandlersDo not instantiate SPWeb, SPSite, SPList, or SPListItemUse what the properties give you
properties.OpenWeb()properties.ListItem
Bulk operations will not run event handlers
Ex: New list created – FieldAdding will not run
![Page 23: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/23.jpg)
Development
Event HandlersConnections
Make sure you code for external systems not being available
LOG ERRORSMake it known why something went wrong
![Page 24: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/24.jpg)
Development
Web PartsDeploy to the Web Part Gallery
Easy to add to a page from there
AllowClose = falseClosing web parts = badX DOES NOT EQUAL DELETE
Use Properties – avoid hard coded valuesHTMLEncode input values
![Page 25: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/25.jpg)
Development
Web Parts – In CodeEnsureChildControls
Ensure that the controls have been loaded before using them.
![Page 26: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/26.jpg)
Development
Unmanaged CodeJavaScript
Will this be used in more than one place?Central Script repository (easy access)Deployment to _layouts folder
More of a “managed” approach, more secureLess flexible
![Page 27: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/27.jpg)
Development
Unmanaged CodeContent Editor Web Parts
Awesome, flexible web parts!Use a library with versioning to link the WP to
Easier to manageVersioning of “code”
Publishing SitesUse content controls, not CEWPs!
![Page 28: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/28.jpg)
Development
Unmanaged CodeGhosted v. UnGhosted pages
Uncustomized v. customizedUnghosted pages can have issues with upgrades
i.e. site definitions change with upgrades
Branding
![Page 29: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/29.jpg)
Development
SharePoint Web ServicesProvide remote access to a range of object model functionalityRun on all front-end web serversHeavily dependent on XML and CAMLReside in physical file system in the \12\... Directory and in a virtual file system in /_vti_bin
![Page 30: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/30.jpg)
Development
SharePoint Web Services – What They Do
Provide programmatic access via .NET and SharePoint DesignerDeliver relatively robust remote API functionalityExpose SharePoint data repository to disconnected clients
![Page 31: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/31.jpg)
Development
SharePoint Web Services – What They Do
Permit inter-farm communication (geographic distribution)Integrate well with WinForms, WPF, and SilverLightClient Object Model (SP 2010)
![Page 32: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/32.jpg)
Development
SharePoint Web Services – What they DON’T do
Do not provide access to entire object modelDo not permit manipulation of BLOB objects (documents)NTLM and Basic Authentication OnlyNo SSO integrationNo extensibility (sealed classes)Limited data aggregation (no joins)
![Page 33: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/33.jpg)
Development
SharePoint Web Services – When to use them
Remote accessibilityIntegration with backend or legacy systemsRetrieval of items and content as XMLPerform large batch updates to lists
![Page 34: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/34.jpg)
Development
SPServices – jQuery library utilized SharePoint Web Services
http://spservices.codeplex.com/
![Page 35: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/35.jpg)
Development
SharePoint Web Services BasicsAdd a Web Reference to any project typeMust specify existing SharePoint site in URL + “/_vti_bin/” + ServiceName + “.asmx”Set URL to dynamic
![Page 36: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/36.jpg)
Development
SharePoint Web Services BasicsAll column names are XML encoded and prefixed with “ows_”<rs:data ItemCount="1" xmlns:rs="urn:schemas-microsoft-com:rowset"> <z:row ows_Title="[email protected]" ows_MetaInfo="4764;#" ows__ModerationStatus="0" ows__Level="1" ows_ID="4764" ows_owshiddenversion="5" ows_UniqueId="4764;#{2272A40C-0DA5-4C0D-938D-BFF3AF9C8ACF}" ows_FSObjType="4764;#0" ows_Created="2009-12-12 12:55:10" ows_FileRef="4764;#sps/Contact/test/Lists/Issues/4764_.000" xmlns:z="#RowsetSchema" /></rs:data>
![Page 37: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/37.jpg)
You might be a SharePoint Developer if…
![Page 38: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/38.jpg)
Development
USE SOLUTION PACKAGES!USE SOLUTION PACKAGES!USE SOLUTION PACKAGES!USE SOLUTION PACKAGES!USE SOLUTION PACKAGES!USE SOLUTION PACKAGES!USE SOLUTION PACKAGES!USE SOLUTION PACKAGES!
![Page 39: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/39.jpg)
Development
User Code Solutions (2010)When possibleForces better programming practicesKeeps the farm safe
Makes admins & managers happy
Admins can controlMakes them feel special
![Page 40: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/40.jpg)
Resources
Development ToolsCodeplex.com
Search SharePoint & Development
SharePointDevWiki.comwww.sharepointdevwiki.com/display/public/SharePoint+Development+Tools
SPDisposeCheckcode.msdn.microsoft.com/SPDisposeCheck
![Page 41: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/41.jpg)
Resources
SDKs2010
Server and Foundationhttp://msdn.microsoft.com/en-us/library/ee557253.aspx
2007WSS
http://msdn.microsoft.com/en-us/library/ms441339(office.12).aspx
MOSS 2007http://msdn.microsoft.com/en-us/library/ms550992(office.12).aspx
![Page 42: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/42.jpg)
Resources
General DevelopmentRoger Lamb’s Blog
blogs.msdn.com/rogerla/
Patterns & Practices SharePoint Guidancemsdn.microsoft.com/en-us/library/dd203468.aspx
Using Disposable Objectsmsdn.microsoft.com/en-us/library/aa973248(v=office.12).aspx
![Page 43: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/43.jpg)
Resources
General DevelopmentWorking with Large Lists
go.microsoft.com/fwlink?LinkId=95450
SharePoint 2007 Best Practices Resource Center
technet.microsoft.com/en-us/office/sharepointserver/bb736746.aspx
![Page 44: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/44.jpg)
You… BEFORE session…
![Page 45: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/45.jpg)
You… AFTER our session…
![Page 46: Just Freakin' Work - Overcoming Hurdles and Avoiding Pain](https://reader033.vdocument.in/reader033/viewer/2022061121/546f3ef6af79593b118b5153/html5/thumbnails/46.jpg)
Resources
Q&APlease be sure to fill out your
session evaluation!