Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
SharePoint 2010 Application Development Overview
1.
2.
3. SharePoint 2010 Platform An evolved version of MOSS and WSS v3 Microsoft SharePoint Server 2010 Microsoft SharePoint Foundation 2010 Development can now be done on client OS Significant enhancement for many development teams Browser Clients Microsoft SharePoint Server 2010 MS Word Clients Microsoft SharePoint Foundation 2010 MS Outlook Clients .NET Framework and ASP.NET 3.5 SP1 Internet Information Services 7.0 Windows Server 2008 (x64 only)for Production Environments Windows 7 or Vista (x64 only) for Development Environments only
5. SharePoint 2010 Dev Enviroment Development must be done against isolated deployment of SharePoint (Virtual) Machine has: Visual Studio 2010 SharePoint Designer 2010 SQL Server 2008 Office 2010 / 2007
6. SharePoint 2010 Developer Tools Visual Studio has robust tools for SP 2010 development Project and item templates Templates for many SharePoint elements Visual Designers and Explorers Feature and Solutions Site contents F5 deployment and debugging Deployment is configurable
7. SharePoint 2010 Projects SharePoint Projects have standard properties Project File Project Folder Active Deployment Configuration Include Assembly in Package Assembly Deployment Target Sandboxed Solution Site URL Startup Item
9. Solution Packages Work done in Visual Studio packaged into a solution for deployment Package is a CAB file with a WSP extension Package contains manifest with deployment instructions
11. Farm and Sandboxed Solutions Farm Solutions Deployed at farm scope Requires administrator rights to deploy Sandboxed solutions Deployed at site collection scope Requires site collection owner rights Restricted to subset of SharePoint server API Restricted resource usage
12. Features Building blocks for creating SharePoint solutions A unit of design, implementation and deployment Contain elements e.g. menu items, links, list types and list instances Many other element types possible Can contain event handlers You can add any code which used WSS object model
14. User’s View of Features Support concept of activation and deactivation
15. SharePoint 2010 System Folders Root folder known as System Root May also hear term 14 Hive This term is being phased out
16. The Features Directory Features may be installed at farm level One folder per Feature Multiple Feature activation scopes Farm, Web application, Site Collection, Site
18. Content Storage in SharePoint Storage is based on the concept of lists Everything is modeled in terms of rows and columns The Document Library is really just a hybrid list SharePoint adds value on top of the generic list Transparent content storage in SQL Server Automatic generation of the user interface
20. List Lookups Lookups form relationships between lists Referential integrity can be enforced Lookup Lookup 1 1 m m Projects Timecards Clients
21. Column Validation Validation Formula can be specified on List and Columns Similar to Excel formulas Example: =[Discount] < [Cost] Column uniqueness constraint
22. Large List Support Check query before execution If Index is not used and number of scanned rows is greater than a limit then block query If number of Joins is greater than limit then block query If enabled on the Web Application, the developer can turn off throttling using:SPQuery.RequestThrottleOverride and SPSiteDataQuery.RequestThrottleOverride
23. Overview of Data Technologies REST APIs Strongly-typed ClientOM Weakly-typed Client-side Data Platform Farm Site List Data External Lists ServerOM Server-side Weakly-typed New in 2010 Improved LINQ Strongly-typed
24. Working with SharePoint 2010 SharePoint Server Application SharePoint API Web Service Client.svc JSON XML Client Application Client OM WPF/WinForm/Office Silverlight JavaScript Client Application
25. Server Object Model The SharePoint version of “Hello, World” Show the root site of a collection and it’s lists using (var site = new SPSite("http://localhost/sites/demo/")) { var web = site.RootWeb; ListBox1.Items.Add(web.Title); foreach (SPList list in web.Lists) { ListBox1.Items.Add("" + list.Title); } }
26. Resource Usage SPSite and SPWeb objects use unmanaged resources Vital that you release resources with Dispose General rules: If you create the object, you should Dispose var site = new SPSite(“http://localhost”); var web = site.OpenWeb(); If you get a reference from a property, don’t Dispose var web = site.RootWeb There are exceptions to these rules Use SPDisposeCheck to analyze code
28. Managed Client Object Model <System Root>SAPI Microsoft.SharePoint.Client 281kb Microsoft.SharePoint.Client.Runtime 145kb To Compare: Microsoft.SharePoint.dll – 15.3MB
29. Managed Client Object Model The SharePoint version of “Hello, World” Show the root site of a collection and it’s lists using (var context = new ClientContext("http://localhost/sites/demo")) { var site = context.Site; var web = site.RootWeb; context.Load(web, w => w.Title); context.Load(web.Lists); context.ExecuteQuery(); ListBox1.Items.Add(web.Title); foreach (var list in web.Lists) { ListBox1.Items.Add("" + list.Title); } }
30. Retrieve Data Client Context methods wrap service calls Context.Load(object, paramsLinqExpression) Fills out the objects in the context: in-place Context.LoadQuery(IQueryable) Use Linq query to return custom objects Not filled into the context var query = from list in clientContext.Web.Lists where list.Title != null select list; var result = clientContext.LoadQuery(query); clientContext.ExecuteQuery();
36. Event Handlers Override methods on known receiver types SPFeatureReceiver SPListEventReceiver SPItemEventReceiver Register receiver as handler for entity Use CAML or code Synchronous and asynchronous events ItemAdding ItemAdded
37. Sample Feature Receiver public class Feature1EventReceiver : SPFeatureReceiver { public override void FeatureActivated(SPFeatureReceiverProperties properties) { var web = properties.Feature.Parent as SPWeb; if (web == null) return; web.Properties["OldTitle"] = web.Title; web.Properties.Update(); web.Title = "Feature activated at " + DateTime.Now.ToLongTimeString(); web.Update(); } public override void FeatureDeactivating( SPFeatureReceiverProperties properties) { var web = properties.Feature.Parent as SPWeb; if (web == null) return; web.Title = web.Properties["OldTitle"]; web.Update(); } }
39. Overview of Data Technologies REST APIs Strongly-typed ClientOM Weakly-typed Client-side Data Platform Farm Site List Data External Lists ServerOM Server-side Weakly-typed New in 2010 Improved LINQ Strongly-typed
40. REST APIs Work with data via Representational State Transfer (REST) SharePoint list data Other data sources as well Excel spreadsheets Azure cloud store Powered by ADO.NET Data Services “Astoria” REST Protocols: Atom, AtomPub, and JSON Integration and Standardization
45. LINQ to SharePoint No CAML Required Entity classes form Business Layer Strongly-typed queries, compile-time check Intelligence helps query construction Microsoft.SharePoint.Linq.dll
46. SPMetal Entities generated using SPMetal utility SPMetal located in <System Root>in spmetal /web:<site Url> /code:Projects.cs Create classes and add them to project
47. Consuming Data with LINQ to SharePoint varsiteUrl = "http://localhost/sites/demo"; var context = new SPNorthwind.SPNorthwindDataContext(siteUrl); var query = from p in context.Products where p.Category.Title == "Beverages" select p; foreach (var item in query) { Console.WriteLine(item.Title); }
49. Web Parts Modular and reusable building blocks typically used in portal style applications Support for customization and personalization Web Part infrastructure required Not specific to SharePoint Not specific to ASP.NET
51. Web Part History Windows SharePoint Services 2.0 Designed with its own Web Part infrastructure WSS serializes/stores/retrieves personalization data ASP.NET 2.0 Includes Web Part infrastructure Serializes/stores/retrieves personalization data More flexible and more extensible than WSS ASP.NET 2.0 does not support WSS v2 Web Parts SharePoint Services 3.0 / SharePoint Foundation 2010 Supports WSS V2 style Web Parts Supports ASP.NET 2.0 style Web Parts (preferred)
52. Web Part Gallery Site collection scoped Both .DWP and .WEBPART files as items SharePoint can discover new candidates from Web.config Maintain metadata Available out-of-the-box parts determined by edition and site template
54. Visual Web Part Project User interface described with markup in User Control Web Part loads User Control dynamically Page.LoadControl Not natively compatible with Sandboxed Solutions There are workarounds
56. Web Part Deployment Deploy assembly to: in folder of IIS Web Application Executes in a sandbox Global Assembly Cache Register Web Part as Safe Control in Web.config Add Web Part to Gallery Process automated by Visual Studio 2010
58. SharePoint 2010 and Silverlight Presentation Silverlight Client Integration Security App Model SharePoint Data Layer Logic Layer
59. Silverlight/SharePoint Solution Silverlight application Build SilverlightUserControl SharePoint application Deploy XAP via Module Add custom project output Use OOB Silverlight Web Part Enable Silverlight Debugging
60. XAP File Deployment Options Virtual file system Document Library Virtual folder structure Limits scope to site or site collection Works with sandboxed solutions Physical file system LAYOUTS folder LAYOUTSlientBin folder Farm scope Does not work with sandboxed solutions
Introduce SharePoint 2010 Many things to many people Use tale of blind men and the elephant as an analogyhttp://en.wikipedia.org/wiki/Blind_men_and_an_elephantEach person describes SharePoint differently because of their experience with the product
This slide gives you an opportunity go explain the features of SharePoint Foundation and ServerLess depth required at UG meetings, more at breakfast sessions
Go over the technology stack Highlight that 64-bit operating systems are required Highlight that SharePoint 2010 is built on .NET 3.5, not .NET 4
Talk about configuration optionsNative hardware, boot to VHD, virtualizationMention that Microsoft Virtual PC does not support 64-bit client OS
Setup for tools you’ll be showing in the upcoming demo
Setup for tools you’ll be showing in the upcoming demo
Focus here is the tools Highlight:Project templatesItem templatesF5 deploymentServer Explorer Build a simple SharePoint projectAdd a list instanceF5 to deploy and see site with list added In the next section we explain what went on behind the scenes
Be sure to mention the solution manifest and discuss its role The package shown in the image is from a demo used in the Web Part section
The solution manifest shown is from a demo used in the Web Part section
Equate Features to components Logical units of functionality
The feature manifest shown is from a demo used in the Web Part section
Discuss activation and deactivation
Give a very quick tour of the system folders
Highlight the Features folder
First part – review the demo shown earlierShow what’s behind the curtain HighlightAuto-created FeatureFeature designerFeature manifestSolution designerSolution manifestDeployment optionsGenerated solution package Second partDeploy the WSP as a sandboxed solutionMake sure old solution is retracted firstMake sure elements created by old solution are deletedOr recreate the site before doing the demo
Good visual aide for previous slide
It’s difficult to cover this topic briefly but it’s too important to omit
Build Hello, World (shows list and list items for a given site)If you feel comfortable build some of the code liveThen walkthrough the pre-created demo highlightingThe commonly used types (SPSite, SPWeb, SPList, SPListItem)The use of LINQ (LINQ to Objects this time)The use of the CAML query
Additional detail about the ways resources can be requested
Build Hello, World (shows list and list items for a given site)If you feel comfortable build some of the code liveThen walkthrough the pre-created demo highlightingThe commonly used types (Site, Web, List, ListItem)Use of batchingThe use of LINQ (LINQ to Objects this time)The use of the CAML query
Mention that event handlers are one place you would commonly use server object model Discuss how event handlers are attached to events of entities