An odyssey into the sharepoint 2010 development world


Published on

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

An odyssey into the sharepoint 2010 development world

  1. 1. An Odyssey Into theSharePoint 2010 Development WorldNik PatelLead Solutions Architect, Slalom Consulting, Chicago Practice
  2. 2. About Me Nik Patel • Lead Solutions Architect, Slalom Consulting • Working with SharePoint 2010 since Summer 2009 • Working with SharePoint since SharePoint 2003 days Contact Info • Email – • Blog – Nik Patel’s SharePoint World - • Twitter - @nikxpatel • LinkedIn - • Slideshare - 2
  3. 3. Session GoalsSetting stage for future sessions This is introductory session  Provides sweeping overview of features, No deep dives, Get ready for fast ride  Focus on both entry-level and experienced SharePoint developers Setting stage for future deep dive sessions Lots of practical tips and lessons I have learned from last 3 years of SharePoint 2010 product lifecycle Provide 1000 ft. view of SharePoint Development landscape in 1 Hour.. It’s tricky but not impossible.  3
  4. 4. Session AgendaNik’s 6 Steps into SharePoint Development Nirvana Step 1 - Understanding SharePoint Developer Role Step 2 - Understanding & Configuring SharePoint 2010 Development Environment Step 3 - Understanding Core SharePoint 2010 Development Concepts Step 4 - Understanding Visual Studio Tooling Support (SP2010 Developer Productivity) Step 5 - Developing SharePoint 2010 Building Blocks and Artifacts Step 6 - Understanding of SharePoint 2010 Data Access Strategies Questions and Answers 4
  5. 5. Step 1 – Nik’s 6 Steps into SharePoint Development Nirvana Understanding SharePoint Developer Role 5
  6. 6. Anatomy of SharePoint Developer RoleIt is demanding, because SharePoint will challenge you like you never been SharePoint Developer is very complex role  SharePoint Developer should be proper End User  Understand SharePoint OOB Capabilities  SharePoint Developer should be strong Power User  Understand Browser Customization and No-Code Solutions  SharePoint Developer should be efficient Administrator  Understand how SharePoint Farm, Web Application, Site Collection, and Service Application Infrastructure Configured  SharePoint Developer should be true programming rock star.   Understand and make decision on what kind of custom artifacts and data access strategies can be designed on SharePoint Platform  Be ready to work with wide varieties of languages and frameworks (e.g. C#, SQL, javaScript/jQuery, AJAX, WCF etc.) Always keep in mind - SharePoint is Packaged Product  SharePoint is Platform and understanding it’s capabilities and limitations are important 6
  7. 7. Typical SharePoint Developer Life – Day to Day ActivitiesExtending SharePoint Platform Provision SharePoint Artifacts  Site Columns, Site Content Types, Lists, Web Parts, Workflows, Pages, Sites, Timer Jobs etc. Build Business Applications based on SharePoint Platform  Accessing SharePoint 2010 Data from SharePoint itself like Lists or Sites Data in Web Parts  Accessing LOB or External Data in SharePoint like CRM, SAP, SQL  Accessing SharePoint Data from Remote External Systems like Standalone ASP.NET, Standalone Silverlight, Console Utilities, CRM Systems etc. Perform Advanced SharePoint Development  User Profiles Provisioning, Search API, Managed Metadata Maintenance Solution Packaging and Deployment  PowerShell Scripting for Solutions and Features deployment, upgrade, and maintenance  Application Life Cycle Management using Automatic Build and TFS integration 7
  8. 8. Step 2 – Nik’s 6 Steps into SharePoint Development NirvanaUnderstanding & Configuring SharePoint 2010 Development Environment 8
  9. 9. Configure SharePoint 2010 Development EnvironmentEvery SharePoint developer should have at least 1 development environment Either install directly on metal or use Virtual machines  My preference is VM – more flexible, I use VMware workstation on Windows 7 x64 Host SharePoint 2010 requires x64 Operating System and Database Servers  Windows 7, Windows Vista SP1, Windows Server 2008, or Windows Server 2008 R2  SQL Server 2012, SQL Server 2008 R2, SQL Server 2008 with SP1 and CU2, SQL Server 2005 with SP3 and CU3 SharePoint 2010 must be installed locally on Developer Machine  SharePoint Foundation or SharePoint Server (RTM or SP1 with latest CU)  Requires Single Server Farm Installation  Not Supported for Production or Multi-Server farm – SQL and AD can be installed on separate machine  Based on .NET Framework 3.5 and ASP.NET 3.5 - Installed as SharePoint 2010 Pre-requisites Visual Studio 2010 (RTM or SP1) and SharePoint Designer 2010  Visual Studio 2010 SharePoint Power Tools – Provides Sandboxed Visual Web Part template  Use Visual Studio 2012 as soon as it’s in RTM, Lot more improvements for SP2010 development 9
  10. 10. Step 3 – Nik’s 6 Steps into SharePoint Development Nirvana Understanding Core SharePoint 2010 Development Concepts 10
  11. 11. SharePoint TerminologyOverwhelming at first, steep learning curve, ever-changing landscape, lifetime to master Farm Solutions Custom Actions Content Type Safe Control Site Pages Feature Site Collection List Instance Timer Job Feature Scope Workflows Solution Package Site Definition Event Receiver Web Templates Publishing Layouts Ribbon Framework List Definition PowerShell Web Application Feature Receiver Document Libraries Team Site Field Control Client Object Model
  12. 12. Understanding SharePoint Object HierarchyServer Side Object ModelSharePoint Hierarchy Object Hierarchy (Top to Bottom) Object Hierarchy (Bottom to Top) Farm SPFarm SPFarm Web Application(s) SPWebApplication SPWebApplication (SPWebApplication.Sites) (SPWebApplication.Farm) Site Collection(s) SPSite (SPSite.AllWebs) SPSite (SPSite.WebApplication) Site(s) SPWeb (SPWeb.Lists) SPWeb (SPWeb.Site) List(s) SPList (SPList.Items) SPList (SPList.ParentWeb) List Item(s) SPListItem SPListItem (SPListItem.ParentList) 12
  13. 13. What is Solutions and Features Framework?Building blocks of SharePoint Development, Packaging, and Deployment Features  Solutions - WSPs  Deployed in {SP Root}TEMPLATEFEATURE  Deployed in Farm Solutions or Sandbox Solutions in Site Collections Solutions Gallery  Features are the basic building block of SharePoint development  Solution Packages are “bundles” of functionality deployed to the farm or site collection  Features may be comprised of any combination of code or artifacts including web parts or workflows  May contain one or more Features, assemblies, pages, controls, and other artifacts  Features may be activated manually or automatically on a local or global basis  SharePoint framework handles installation and configuration of solution items automatically across  Features are scoped at Farm, Web Application, Site entire farm Collection, and Web Level 13
  14. 14. Sandbox vs. Farm Level Solutions Execution environment during runtime Farm Level Solutions  Sandbox Solutions  Also known as Full Trust Solutions  Also Known as User Solutions  Deployed to Farm Solutions Gallery by Farm  Deployed to Site Collection Solution Gallery by Site Administrators Collection Administrators  Runs inside IIS Worker Process (W3WP.exe) for specific  Runs inside Application domain per site collection in the web application Sandbox Worker Process (SPUCWorkerProcess.exe)  Stored in the SharePoint Configuration Database  Stored in the Site Collection Content Database  Farm level solutions requires SharePoint Foundation Web  Sandbox solutions requires Microsoft SharePoint Application Service started on the farm. Foundation Sandboxed Code Service started on the farm.  Farm level solutions not restricted to any data access  Sandbox solutions runs using restrictive code access  Farm level solutions are not restricted to resource quotas security policies and limited to a specific subset of and code will run until IIS worker process terminates by SharePoint 2010 object model – Major limitations are not itself able to access database, file system, RSS feeds, web services, cross-site collection, farm and web application scoped features, running with elevated privileges  Sandbox solutions runs under resource quota and exceeding resource quota with irresponsible code will terminate the process 14
  15. 15. Typical SharePoint Solution Deployment, Upgrade, and Retraction ProcessUse Visual Studio, Central Administration, or PowerShell for Deployment and RetractionTypical Deployment Farm Typical RetractionSequence Web Application Sequence1. Add Solution2. Deploy Solution Site Collection 1. Deactivate Features3. Activate Features i. Web(s) i. Farm ii. Site Collection(s) ii. Web Application(s) Web iii. Web Application(s) iii. Site Collection(s) iv. Farm iv. Web(s) 2. Retract Solution4. Update Solution (Upgrade) 3. Remove Solution Solutions Gallery Please note that Adding and Updating Solution is not supported in Central Administration site. 15
  16. 16. Step 4 – Nik’s 6 Steps into SharePoint Development Nirvana Understanding Visual Studio Tooling Support 16
  17. 17. Getting Started – Initial SharePoint 2010 Project Setup Understand Visual Studio Tooling Support VS2010 with SharePoint 2010  Works Perfect Together - Build, Debug, Deploy, and Package Project Templates  Empty SharePoint Project, Import from Solution Package Item Templates  Visual Web Part, Web Part, Workflow, BDC Model, Application Page, Event Receiver, Module, Content Type, List Definition, Empty Element Visual Designers  BCS Model, Visual Web Parts, Workflows in Visual Studio 2010 New in Visual Studio 2012 RC  Much better organization of project templates and item templates- removed unnecessary project templates  Added Content Type and List Designer (2010 requires CAML coding)  Added Site Column and Silverlight Web Part Item Template 17
  18. 18. Getting Started – Project Packaging and Maintenance Understand Visual Studio Tooling Support Project Wizard  URL where you want to deploy  Farm vs. Sandbox Solution Deployment Project System  Solution Explorer - Deploy, Retract, and Package  Project Properties - Site URL, Sandboxed Solution etc.  Mapped Folders – SharePoint Root  Feature and Package Designer  Generate WSP for Production Deployment Server Explorer - SharePoint Site Collection Connections from Visual Studio  Hierarchical view of local SharePoint sites & artifacts  View SharePoint site collections, sites, features, lists, site columns etc TFS and Source Control Integration 18
  19. 19. DemoWalkthrough of Hello World Web Part in Visual StudioWhat really happens when you deploy farm solution? 19
  20. 20. Reference Card – What really happens when you deploy farm solution?Understanding what really happens under the hood is keyAreas affected by SolutionsDeployment SharePoint Configuration Database, Objects Table Web Application Content Databases, Features Table Central Administration, Solutions Gallery File System - SP Root Folder GAC - Global Assemblies Gallery Web Application Web.config files Activate Site Collection or Site Features Site Collection Galleries like Web Parts or Master Pages or file provisioned in content databases For More info - deploymentretraction-feature-activationdeactivation-process/ 20
  21. 21. Step 5 – Nik’s 6 Steps into SharePoint Development Nirvana Developing SharePoint 2010 Building Blocks and Artifacts 21
  22. 22. Developing SharePoint Artifacts Extending SharePoint Deployment through CAML or Platform APIs Common Artifacts  Site Columns, Site Content Types, Field Types  List definition and List Instances  Event Receivers  Site Pages/Web Part Pages, and Application Pages  Web Parts & Visual Web Parts  Workflows  Site Definition, Web Templates, and Site Provisioning Process  Custom Actions, Ribbon and Dialog Framework Typically Three Approaches for Provisioning SharePoint Artifacts  CAML Approach using Feature.xml and Elements.xml  Programmatic Approach using Feature Receiver  Programmatically Provisioning components using C# or PowerShell 22
  23. 23. Demo• Provision List Definition and List Instance 23
  24. 24. Step 6 – Nik’s 6 Steps into SharePoint Development Nirvana Overview of SharePoint 2010 Data Access Strategies 24
  25. 25. SharePoint Data Access Strategies Three Common Design Patterns Accessing SharePoint Data from SharePoint itself  Accessing data from Current Site Collection, Cross-Site Collection, Cross-Web Application, or Cross-Farm  Many options to choose from - SSOM, LINQ to SharePoint, CSOM, REST based API, ASMX Web Services, Custom WCF Services, Search APIs etc. Accessing External Data from SharePoint  Accessing LOB or External Data in SharePoint like CRM, SAP, SQL, etc.  Many Options to choose from - LINQ-to-SQL, ADO.NET, Entity Framework, Web Services Interface, or SharePoint Preferred method BCS for Platform Integration Accessing SharePoint Data from Remote Systems  Accessing SharePoint Data from Remote External Systems like Standalone ASP.NET, Standalone Silverlight, Console Utilities, CRM Systems etc.  Many Options to choose from - CSOM, REST based API, ASMX Web Services, Custom WCF Services etc. 25
  26. 26. Overview of SharePoint 2010 Data TechnologiesUnderstanding both Client side and Server side API is key REST APIs ASMX Web Services Client OM Farm Site List Data External Lists 26
  27. 27. Making decision – Questions you should ask yourself Understanding what really happens under the hood is key How will your code will be deployed?  Farm solution or sandboxed solution or non-SharePoint solutions How important is developer productivity?  Are IntelliSense, Compile time errors, and strongly-typed access important? Where will your code run?  Server-side code or client-side code  Within SharePoint, .NET Applications like Silverlight or CRM, Non.NET Applications like Java or JavaScript What is the scope of your code to run?  Same Site, Same Site Collection, Cross-Site Collection, Cross-Web Application, Cross-farm How many items your query will return?  5 items or 500 items or 5,000 items or 50,000 items 27
  28. 28. Overview of Server Side Data Access Technologies Both Options Must Run on the SharePoint Servers Server Side Object Model – SPQuery and SPDataQuery • SPQuery executes query against single list or performs join with on multiple lists on lookup columns with in site collection • SPDataQuery executes query against multiple lists to aggregate results, scoped at site collection level. • SPQuery uses CAML fragments and access to columns is not strongly typed - hard coded column names, quirky syntax, lack of tooling support, and difficult debugging • CAML provides fastest way to access data, must be used in high performing applications LINQ-to-SharePoint  Executes query against single list or performs join on multiple lists on lookup columns with in site collection, You can’t aggregate multiple lists data without lookup column  Microsoft supplies spmetal.exe to generate LINQ to SharePoint entities, Needs to regenerate the entities if List Schema changes  Strongly typed entities to perform CRUD operations against SharePoint data  High productivity, IntelliSense, and less error-prone programming  Translates into CAML query during runtime, little performance overhead, 5-10% slower than SPQuery 28
  29. 29. Comparing SharePoint 2010 Server Side Data TechnologiesDecision Making Process SPQuery SPDataQuery LINQ to SharePoint Querying SharePoint list data within a site X X Using joins on SharePoint lists within a site X XUsing joins on SharePoint list data across sites within a site collection X X Aggregating list data across multiple sites within a site collection X Querying external list data within a site X Strongly typed data access, IntelliSense Support, and High X Productivity (Requires leaning of LINQ) High performance & faster queries (Requires learning of CAML) X XError prone coding - hard coded column names, quirky syntax, lack of X X tooling support, and difficult debugging Needs to regenerate the data context classes if schema changes X Reference - More Info - 29
  30. 30. Overview of Client Side Data Access Technologies Avoid these options running on the SharePoint Servers unless Cross-farm situations or Office 365 limitations Client Side Object Model – WCF Service - Client.svc • Three different Models - .NET Managed, Silverlight, ECMAScript • Subset of server OM functionality but similar APIs, Can’t access data outside of current site collection • CSOM executes query against single list or performs join on multiple lists on lookup columns with in site collection  Allows submitting CAML queries directly from client side logic, same restrictions as SPQuery - Fastest option but error prone coding REST API - WCF Data Services - ListData.svc • REST is HTTP-based XML data transfer design pattern based on OData protocol - Stateless, cacheable, uniform • Returns results in ATOM Feed or JSON format (For JS clients) • Able to maintain & browse lists using HTTP verbs - GET, POST, PUT, DELETE, and MERGE • Available for Lists (ListData.svc) and Excel Services REST API (ExcelRest.aspx) • Client-side technique with strongly typed access, Intelligence Support, LINQ style productivity, Same restrictions as LINQ-to-SharePoint, Needs to refresh the proxy class if List Schema changes Legacy ASP.NET SOAP based Web Services  Scoped at the List or Library level data access, requires custom web services for multiple list joins  Developer must parse CAML fragments and access to columns is not strongly typed  Supports advanced SharePoint Server capabilities like search, social, or user profile services, which are unavailable through the CSOM or REST APIs 30
  31. 31. Comparing SharePoint 2010 Client Side Data TechnologiesDecision Making Process CSOM REST API ASMX Web Services SharePoint Data Access Scope Site Collection List List List Queries X X X List Join Queries X External List Queries X Request Batching X X Synchronous Operations X (Except ECMA) X Asynchronous Operations X X X SharePoint Foundation Object Model Access X Access to SharePoint Server Functionality X (Social, User Profiles, and Search Data) Supports Non-Windows Clients X (ECMA only) X X Supports Strongly Typed LINQ Queries X(objects only, no list queries) X (with proxy, lists only) Requires CAML for List Data Access X X Access from Sandbox Solutions X (SPServices Plugin)Reference - More Info - 31
  32. 32. Demo• Accessing SharePoint List data using JavaScript CSOM 32
  33. 33. Advanced Data Access Technologies Enterprise Level Data Access Methods Custom WCF Web Services  Extend out of box SharePoint functionality  Can be hosted in SharePoint, IIS, or any other .NET client  Ideal for third party vendors, ISVs, or enterprise system integration Business Data Connectivity Services  New in SharePoint 2010, Replacing Business Data Catalog  Allows interface to external entities by implementing read-write interface to the external data by external content types and external list  Provides platform integration for external systems for secured data access and search  Useful alternative to access data from traditional manner like LINQ-to-SQL, ADO.NET, or Entity Framework Enterprise Search API  This is Enterprise Search capability, not FAST Search  Perfect for Cross-farm, Cross-Web Application, or Cross-Site Collection Data Access  Greater scalability, All other techniques are mostly SQL-based, fast even large amount of data across multiple farms  Requires data must be in index, data must be tagged, and mapped to managed properties 33
  34. 34. What’s Next for you? Practice, adhere, and master SharePoint development best practices  Here is the start - Stay connected and Involved in Community – User Groups, Conferences, Webinars, Code fests Stay active on Social Media  Follow Major MVPs and MSDN Blogs – Bookmark great articles  Follow MVPs and major SharePoint Community Players on Twitter and Facebook Major Resources  SharePoint 2010 SDK -  Patterns & Practices - Developing Applications for SharePoint 2010 -  MSDN SharePoint Developer Center -  MSDN SharePoint 2010 Forums - 34
  35. 35. • Thanks for attending the session!!• Follow Chicago SharePoint Developers User Group • Twitter - @ChDevSPUG • Website - 35