Just Freakin' Work - Overcoming Hurdles and Avoiding Pain
Post on 21-Nov-2014
1111 Views
Preview:
DESCRIPTION
Transcript
Just Freakin’ Work!Avoiding Common Hurdles in SharePoint
Development
Geoff VaroskyMark Rackley
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: mrackley@gmail.com
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: gvarosky@grace-hunt.com
You might be a SharePoint Developer if…
Agenda
IntroductionDevelopmentDeploymentResourcesQ&A
Introduction
Types of DevelopmentDevelopment ToolsDevelopment EnvironmentDeveloping to Deploy
Introduction
Types of DevelopmentUnmanaged CodeManaged CodeCustomization
Introduction
Development ToolsSTSDEV (2007)
stsdev.codeplex.com
WSPBuilder (2007 & 2010)wspbuilder.codeplex.com
CKS:DEV (2010)cksdev.codeplex.com
SharePoint Designer
Introduction
Development EnvironmentPhysical?Virtual?Desktop?Dusty old PC under the desk?
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.
Introduction
Development EnvironmentFollow the SDK (2010)
64 bitDesktop
Windows 7Vista (SP1+)Http://msdn.microsoft.com/en-us/library/ee554869.aspx
Server 2008
Introduction
Development EnvironmentMake sure your environment matches deployment targets!
In Visual StudioCPU
x86? x64? AnyCPU?
.NET FrameworkService PacksSame architecture
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
Development
General Development PracticesListsEvent ReceiversWeb PartsUnmanaged CodeWeb Services
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
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
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
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
You might be a SharePoint Developer if…
Development
ListsTest queries before deployment!U2U CAML Query Builder
Remove the <Query></Query> tags!
http://www.spsprofessional.com/sqlcaml.aspxLINQBatch queries when possible
Development
ListsDo not use SPList.Items
Use SPList.GetItems(query)Paginate (2000 items) – RowLimit
GetItemByIDUse SPList.GetitemByIDNot SPList.Items.GetItemByID
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
Development
Event HandlersConnections
Make sure you code for external systems not being available
LOG ERRORSMake it known why something went wrong
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
Development
Web Parts – In CodeEnsureChildControls
Ensure that the controls have been loaded before using them.
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
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!
Development
Unmanaged CodeGhosted v. UnGhosted pages
Uncustomized v. customizedUnghosted pages can have issues with upgrades
i.e. site definitions change with upgrades
Branding
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
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
Development
SharePoint Web Services – What They Do
Permit inter-farm communication (geographic distribution)Integrate well with WinForms, WPF, and SilverLightClient Object Model (SP 2010)
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)
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
Development
SPServices – jQuery library utilized SharePoint Web Services
http://spservices.codeplex.com/
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
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="Elmer@Fudd.com" 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>
You might be a SharePoint Developer if…
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!
Development
User Code Solutions (2010)When possibleForces better programming practicesKeeps the farm safe
Makes admins & managers happy
Admins can controlMakes them feel special
Resources
Development ToolsCodeplex.com
Search SharePoint & Development
SharePointDevWiki.comwww.sharepointdevwiki.com/display/public/SharePoint+Development+Tools
SPDisposeCheckcode.msdn.microsoft.com/SPDisposeCheck
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
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
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
You… BEFORE session…
You… AFTER our session…
Resources
Q&APlease be sure to fill out your
session evaluation!
top related