Basel · Baden Bern · Brugg · Lausanne Zurich Düsseldorf · Frankfurt/M. · Freiburg i. Br. Hamburg · Munich · Stuttgart · Vienna Entwicklung von SharePoint 2010 Anwendungen Simon Amrein Consultant simon.amrein@trivadi s.com Zürich, 23.04.2010
Feb 06, 2016
Basel · Baden Bern · Brugg · Lausanne Zurich Düsseldorf · Frankfurt/M. · Freiburg i. Br. Hamburg · Munich · Stuttgart · Vienna
Entwicklung von SharePoint 2010 Anwendungen
Simon [email protected]
Zürich, 23.04.2010
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 2
Speaker
Name Simon Amrein
Company Trivadis AG
Email [email protected]
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 3
Agenda
Data are always part of the game.
Visual Studio 2010 Support
LINQ to SharePoint
Client Object Model
Business Connectivity Service
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 4
Better support for SharePoint development
Support only for SharePoint 2010 (no extended SharePoint 2007 support)
Easy way to Debug Feature/Solution
F5 – Deployment
Visual Studio 2010
© 2010
Templates
Event Receivers
Web Partsincl Visual WebPart (no more SmartParts)
Workflows
Content Type
List / Site Definition
BCS Model
Empty Projext
MSDN TechTalk - SharePoint 2010 für Entwickler 5
© 2010
SharePoint 2010 Project Templates
All Projects built using standard structure
Common Project Properties Project File Project Folder Assembly Deployment Target Sandboxed Solution Site URL Startup Item
MSDN TechTalk - SharePoint 2010 für Entwickler 6
© 2010
SharePoint 2010 Project Structure
Standard Project Nodes Properties References Features
Package SharePoint Project Items
(optionally added by dev using SharePoint 2010 Developer Tools)
MSDN TechTalk - SharePoint 2010 für Entwickler 7
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 8
Add-in for Server Explorer window Easy way to examine site artifacts Quick way to launch browser into site
SharePoint Explorer extensibility Developers can write add-ins to
populate nodes and provide contextual menu commands
Local machines only
Server Explorer
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 9
Configure Feature with VS Support
Define Scope (Farm, Site, Web, WebApplication)
Feature Designer
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 10
Define features and additional files for WSP-Package
Edit Manifest manually if required
The way to build your WSP File – No WSPBuilder needed anymore
Package Explorer
© 2010
Deployment
F5 deployment on testsystem
STSADM / Powershell
… but Solution Installer is still a good opportunity…
MSDN TechTalk - SharePoint 2010 für Entwickler 11
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 12
Demo
Data are always part of the game.
Visual Studio 2010
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 13
Agenda
Data are always part of the game.
Visual Studio 2010 Support
LINQ to SharePoint
Client Object Model
Business Connectivity Service
© 2010
SQL Query
string cs =“Data Source=localhost;…..“;using (SqlConnection c = new SqlConnection(cs)){ c.Open(); SqlCommand cmd = c.CreateCommand(cs); cmd.CommandType = CommandType.Text; cmd.CommandText = “SELECT * FROM…..”; SqlDataReader r = cmd.ExecuteReader();….
© 2010
XML Query
XmlTextReader r = new XmlTextReader(“c:\data.xml”);While(r.Read()){
XmlNodeType nt = r.NodeType; switch(nt) { case XmlNodeType.Element: …. case XmlNodeType.Attribute: ….
© 2010
2007-Style CAML Query
<Where> <Gt> <FieldRef Name='EndDate'/> <Value Type='DateTime'> <Today OffsetDays=\"-1\"/> </Value> </Gt></Where>
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 17
What is LINQ?
Language Integrated Query
Simplified, object-oriented way to query
Bridges OOP and relational data
Compile-time checked queries
Provides IntelliSense inside Visual Studio
Unified syntax for querying any data source
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 18
LINQ to SharePoint
No CAML Required
Entity classes form Business Layer
Strongly-typed queries, compile-time check
Intellisense helps query construction
Microsoft.SharePoint.Linq.dll Encapsulates the SharePoint object model queries based on the
created entity classes
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 19
Using LINQ to SharePoint
Create Entity
Classes
Create DataContext
Writer Queries
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 20
Creating Entity Classes
Generated from spmetal utilityspmetal /web:<site Url> /code:Projects.cs
Create classes and add them to project
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 21
DataContext Object
DataContext class allows access to list data
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 22
Modifying List Data
Changes to entity objects are tracked by Linq provider
Changes submitted SubmitChanges() method is called
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 23
Demo
Data are always part of the game.
LINQ to SharePoint
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 24
Agenda
Data are always part of the game.
Visual Studio 2010 Support
LINQ to SharePoint
Client Object Model
Business Connectivity Service
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 25
Why Client Object Model?
More SharePoint Web services is a major request
Client Object Model provides complete API instead of more services
Provides an abstraction layer to return results as recognizable SharePoint objects
Consistent developer experience across platforms (.NET, ECMAScript, Silverlight)
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 26
Supported Areas
Site Collections and Sites
Lists, List Items, Views, and List Schemas
Files and Folders
Web, List, and List Item Property Bags
Web Parts
Security
Content Types
Site Templates and Site Collection Operations
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 27
Equivalent Objects
Server (Microsoft.SharePoint)
.NET Managed(Microsoft.SharePoint.Client)
Silverlight(Microsoft.SharePoint.Client.Silverlight)
JavaScript(SP.js)
SPContext ClientContext ClientContext ClientContext
SPSite Site Site Site
SPWeb Web Web Web
SPList List List List
SPListItem ListItem ListItem ListItem
SPField Field Field Field
Member names mostly the same from server to client (e. g., SPWeb.QuickLaunchEnabled = Web.QuickLaunchEnabled)
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 28
Using the Client Object Model
© 2010
.NET Client OM
ClientContext clientContext = new ClientContext("http://server");
//Load methodclientContext.Load(clientContext.Web); clientContext.Load(clientContext.Web.Lists);
//LoadQuery methodvar q1 = from list in context.Web.Lists where list.Title != null select list; var r1 = context.LoadQuery(q1);
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 30
Demo
Data are always part of the game.
.net Client Object Model
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 31
Silverlight Client OM
Silverlight Development Enabled by Client OM
Can use Silverlight in separate ASPX page or in Web Part
Can utilize Client OM in Silverlight to create SharePoint apps
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 32
Creating Silverlight Web Parts
A Web Part can be a host for Silverlight
SharePoint ships with Silverlight web part
The web part can contain custom properties that are sent to Silverlight via the InitParameters property
The XAP file can be deployed to LAYOUTS and loaded at run time
The Silverlight application can then make use of the Client OM.
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 33
Silverlight Client OM
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 34
Demo
Data are always part of the game.
Silverlight WebPart
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 35
Agenda
Data are always part of the game.
Visual Studio 2010 Support
LINQ to SharePoint
Client Object Model
Business Connectivity Service
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 36
Business Connectivity Services
Provide connectivity support to the following types of external systems: Databases Web/WCF services Microsoft .NET Framework connectivity assemblies Custom data sources
Read and Write
Provides rich cache, offline work features and supports cache-based operations.
Batch and Bulk Operation Support
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 37
BCS Architecture
CustomSQL
External DataWCF
Cache
Business Connectivity Services
Client Runtime
SharePoint Server 2010
Business Connectivity Services
Secure Store Service (SSS)
Search, Workflow, Web Parts
External Content Types (ECT)
Server Runtime
SharePoint Site
VSTOPackage
External List
Office Client
Office Integration
External Business Parts
Custom Code
.NET Connector
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 38
Solution Types, Personas and Tools
Power User / No code RAD Dev
• OOB UX on thin and rich clients (Outlook and Groove) based on External Lists• Custom Forms in SharePoint and
Groove• Connect to existing back-end
integration services or simple databases• Simple BDC Models (few ECTs,
simple associations)• Transparent packaging (managed by
BCS)
Advanced
Advanced Dev Custom Code
• Custom UX and data integration on thin and rich clients (apps that support VSTO add-ins)• Through Office, SharePoint and BCS
Object Models• Custom back-end connectivity
through .Net objects• Complex BDC models (many ECTs,
complex associations)
• Explicit packaging (managed by dev)
SharePoint Designer
Simple
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 39
Development ApproachesSharePoint Server
(Prod / Dev)IT Admin
Import & ConfigureWSP/BDC
SI/IT Devs
“Live” connection
SharePoint Designer
No code, discover and configure existing back-end integration end-points
Connect to (existing) WCF, ADO.Net and .Net Objects
Simultaneously author thin and rich client UX for External List and InfoPath Forms
Pro Dev
Produce WSP/ClickOnce Package w/BDC Model
WSP/ ClickOnce Package
Create custom back-end integration logic using .Net code
Author thin and rich client UX (independently) as SharePoint and VSTO customization projects
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 40
SharePoint Designer
Connecting to an externaldatasource – Just a fewclicks to go…
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 41
Agenda
Data are always part of the game.
External List – SharePoint Designer
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 42
Visual Studio 2010 Support
The tool for creating “.NET Connectors”
© 2010MSDN TechTalk - SharePoint 2010 für Entwickler 43
Agenda
Data are always part of the game.
External List – Visual Studio
© 2010
Courses / Events
Microsoft Ignite Training SharePoint 2010 for developers (4Tg) 21.06.-24.06.2010 in Zürich 06.09.-09.09.2010 in Basel
SharePoint 2010 – Was ist neu für Administratoren und IT Professionals (5Tg) 20.09.-24.09.10 in München 18.10.-22.10.10 in Zürich
MSDN TechTalk - SharePoint 2010 für Entwickler 44
Basel · Baden Bern · Brugg · Lausanne Zurich Düsseldorf · Frankfurt/M. · Freiburg i. Br. Hamburg · Munich · Stuttgart · Vienna
Thank you!
?www.trivadis.com