SharePoint Developer Building Blocks: Technologies for Creating SharePoint Applications
You can use a variety of languages, frameworks, object models, and tools to build scalable distributed web applications on the SharePoint 2010 development platform. It can be difficult for a developer new to SharePoint to know what to use to accomplish various scenarios, or even what is possible. This article provides a high-level overview of SharePoint as a development platform, compares and contrasts SharePoint development to other types of development, and lists the SharePoint Developer Building Blocks, which are the technologies that you use to build a SharePoint application. Perhaps the biggest challenge for you as a SharePoint developer is to understand what your choices are for building blocks, and to select the correct options that meet your architectural and design goals.
This blog is inactive.
New blog: EricWhite.com/blog
Blog TOCThis is the MSDN article that I’ve been literally obsessing about for the last few weeks, to be published sometime in the near future. After it is published on MSDN, I’ll update this post with a link to the MSDN article. AJ May and Dallas Tester contributed to this article. It was technically reviewed by Mike Morten, Mary Lee, Iouri Simernitski, Dallas Tester, Siew Moi Khor, Erika Ehrli Cabral, and Jim Corbin.
I wrote this article with myself as the prospective reader (before learning about SharePoint 2010).
Table of Contents
- Introduction
- What is a SharePoint Application?
- Comparing and Contrasting SharePoint Development with other Forms of Development
- Building Scalable .NET Web Applications
- SharePoint Development vs. Database Application Development
- SharePoint Development compared to Traditional Rich Client Development
- Languages and Platforms
- SharePoint Application Development Terms
- Varieties of SharePoint Applications
- SharePoint Capabilities
- SharePoint Developer Scenarios
- SharePoint Developer Building Blocks
- Developer Dashboard
- Accessibility
- SharePoint Development Tools
- Setting up a Development Environment
- Application Lifecycle Management (ALM)
- Conclusion
- Additional Resources
Introduction
From a high level, it is useful to examine SharePoint development from a number of different viewpoints, such as:
· How SharePoint development compares to and contrasts with other forms of development:
o Scalable loosely coupled ASP.NET application development
o Database application development
o Traditional rich client development
· What languages and frameworks must developers know?
· How do document formats such as Open XML affect your application design? What new scenarios are possible?
This article presumes that the decision to use the SharePoint development platform has been already made. This is the position that many developers are in. In some cases, developers are assigned to a project that uses SharePoint as a platform. In others, developers are proactively developing their skills.
From a high level, the SharePoint 2010 developer architecture consists of a number of layers of technology. It is an ASP.NET application that is built on SQL Server, and runs on Windows Server. The following diagram shows how a number of the more critical building blocks use underlying systems to provide necessary functionality.
Figure 1: Diagram of key building blocks and underlying systems
It can be a bit daunting to see the breadth of technologies that a SharePoint developer must know. When I jumped into SharePoint development, I started from a spot similar to many other developers who enter SharePoint development. I was a competent developer with in-depth experience in a few areas (in my case, C/C++/C#/.NET/LINQ/SQL/XML/Open XML), shallower experience in a number of areas, and a cursory knowledge of others.
I had to deepen my knowledge in the following technologies:
· ASP.NET
· ASP.NET Themes and Skins
· Html and CSS
· JavaScript
· ASP.NET Web Parts
· IIS
While I understood the architecture, as a developer I needed to learn the details of the following technologies almost from scratch.
· The SharePoint object model
· The SharePoint managed client object model
· Silverlight and XAML
· Workflows
· WCF and web services
· SharePoint REST APIs
· Excel Services
· Windows Identity Foundation and claims-based identity
Each of these technologies requires some amount of study. The basic concepts are not difficult, but learning enough to be proficient can be a lengthy process.
In this article, I’m going to list some of my thoughts about various aspects of SharePoint development. I’m going to correlate aspects of SharePoint development to previous experiences. What was similar to previous development environments that I’ve worked in? What was different? I’m also going to discuss how I think of SharePoint development. What comprises a SharePoint application? What are my options for building one? What is the big picture, and where do I need to drill down when implementing a particular scenario? My goal is to outline the key aspects that you need to know in order to be effective at SharePoint development.
What is a SharePoint Application?
To summarize, SharePoint Server is a system with the following capabilities:
· Sites – Web Sites both inside and outside the firewall.
· Communities – Collaboration through wikis, blogs, and more.
· Content – Enterprise Content Management (ECM) – Web Content Management (WCM) – Publishing Systems.
· Search – SharePoint includes a search engine that you can customize for your needs.
· Insights – Business Intelligence (BI).
· Composite Applications – includes data access, user interface, processes, and infrastructure.
SharePoint is a scalable architecture that can be appropriate for a few users, or 100,000 employees of a large corporation. For web sites outside of the firewall, SharePoint for Internet Services allows you to build scalable, flexible web sites that you can maintain with the ease of maintaining a SharePoint site.
In most cases, when you build a SharePoint application, you are adding additional capabilities to the core functionality. You may want to streamline the user interface for some important users. You may want to provide some custom capabilities in several Web parts for a particular vertical market such as construction, law, or manufacturing.
In a few cases, you may build a stand-alone application that makes programmatic use of SharePoint’s capabilities. The end user may never see the SharePoint user interface, or even be aware that the application is developed using SharePoint as part of its infrastructure.
Customization can be light or deep. Your entire customization may consist of a single web part that enables some scenario in your group or team. Or you may be building a complex commercial application that has data flow and processes. You may have integration (deep or shallow) with external Customer Relationship Management (CRM) or Enterprise Resource Planning (ERP) systems.
SharePoint’s integration with the Microsoft Office 2010 system is important. You can take advantage of this integration to build solutions such that no matter where your users are – in an Office client application or in a web browser – the features of your application are discoverable and convenient for them. At various places in this article, I’ll discuss where SharePoint development intersects with Office 2010 client development.
Comparing and Contrasting SharePoint Development with other Forms of Development
Building Scalable .NET Web Applications
You can look at SharePoint development from the perspective of a developer who builds highly scalable, loosely coupled web applications that run on large server farms. These applications need to be capable of handling hundreds or thousands of page views per minute.
At its core, SharePoint is an ASP.NET application that runs on IIS and can have multiple web front end machines that handle load balancing. SQL Server provides the integrity, scalability, robustness, and security of your data and documents that you store in your SharePoint sites. Following are some important ways that scalability affects SharePoint development.
· API Design - Scalability drives certain characteristics of SharePoint’s programming interfaces. It is easier to grasp SharePoint’s programming interfaces when you understand that they are designed to facilitate scalability. For example, the SharePoint 2010 Managed Client Object Model, while very similar in abstractions to the SharePoint server object model, is more complex because it allows you to explicitly control when you retrieve data or content from the server.
· Solution Design - Scalability influences how you design a solution built on SharePoint. You need to avoid designs that cause unnecessary computation or querying activity on the server. You need to write applications that do not consume more resources than they should. For instance, this means appropriately using Collaborative Application Markup Language (CAML) and LINQ to SharePoint to query for list items.
· Best Practices - Scalability is behind certain programming approaches and issues that are ‘best practices’ of SharePoint development. For example, certain objects in the SharePoint Object Model have unmanaged data associated with them, so you need to understand and follow the rules around object disposal. Similarly, there are several best practices to keep in mind when working with large lists in SharePoint. If you don’t follow those rules, you can negatively impact the farm. See Best Practices with SharePoint Server for more information. See also Best Practices: Using Disposable Windows SharePoint Services Objects and Dispose Patterns by Example. You can Automate SharePoint Dispose() code reviews with SPDisposeCheck.
These are issues that are identical or similar to the issues that developers face who are building highly scalable web applications. I heard a story about a SharePoint developer who wrote code to iterate over all documents in his site collections at regular intervals and assemble information to be presented in a tree control. This worked fine in his test environment, but the code design presented a performance problem with real-world quantities of documents and list items.
Scalability affects solution design in two distinct ways.
· Building distributable applications - Build solutions that will work properly when deployed on multiple web front ends (WFE). For example, you could build a little Create/Retrieve/Update/Delete (CRUD) web service for Business Connectivity Services (BCS) that stores data in a local XML file, but that would not work when deployed on a load-balancing farm.
· Building applications that perform well – For example, unless you know for certain that a list will contain few enough list items, don’t iterate over them using the object model; use LINQ to SharePoint instead, and give SharePoint a chance to optimize.
For more information about how SharePoint is similar to and different from ASP.NET development, see Glide Path for the ASP.NET Developer. See also SharePoint 2010 Development for ASP.NET Developers.
Best Practices with ASP.NET Developers contains guidance that will help you avoid pitfalls that can adversely impact performance, including guidance around object disposal, event receivers, large folders and lists, and code performance optimization.
SharePoint Development vs. Database Application Development
Database application development is one of the good vantage points for viewing SharePoint development. Custom lists in a SharePoint site have much in common with database tables. You can define columns in lists, with rich metadata about those columns. Further, SharePoint lists can effectively have ‘foreign keys’ defined, so that you can model more interesting scenarios that contain related data. SharePoint provides cascade and restrict behavior for delete operations. You can create these lists programmatically or declaratively, or you can write programs that work with lists that users have defined. These lists can be visible or hidden. You can use the security features of SharePoint to restrict access.
One aspect of SharePoint that is a direct parallel to SQL databases is that you use a non-procedural declarative query language to retrieve data. However, instead of using SQL, you use LINQ to SharePoint or CAML, which you write using XML.
SharePoint’s integration with database technology is deep. You can use BCS to consume databases, web services, and just about any data source. These data sources are represented as an External Content Type (ECT).
An interesting characteristic of the data capabilities of SharePoint is that it doesn’t have transactional guarantees. You can’t, for instance, insert a list item in one table, and update a list item in another table, and be guaranteed that neither or both will take place. SharePoint is not intended for use as a platform to implement transactional systems. Instead, such transactional systems should be implemented in external databases that can provide the appropriate guarantees. That data can then be brought into SharePoint using BCS. As you design your SharePoint application, you must take this characteristic into account.
A notable difference between the data capabilities of SharePoint and traditional database development is that SharePoint lists (comparable to database tables) are not necessarily rectangular. In SharePoint, a content type defines the fields that comprise a list item (comparable to a row) in a list. This can be thought of as the schema for a list item. A SharePoint list can contain list items of more than one content type. The following figure depicts a SharePoint list that contains items of two content types: LABOR, and MATERIAL.
This impacts how you design and develop applications that consume list items and the fields in list items. If you require rectangular data, you can define lists such that they can contain only one content type. If you allow non-rectangular data, when you iterate through list items, as necessary, you need to check for the content type and alter the behavior of your code accordingly.
Another interesting characteristic – due to internal implementation details (not least of which is the point made in the previous paragraph), querying SharePoint using LINQ to SharePoint or CAML is quite a bit slower than querying tables using SQL. You do not want to create a design where some list unintentionally grows to 50,000 or 100,000 items, and the user is free to attempt to bring the list up in a window in a browser. SharePoint 2010 contains throttling features that prevent such designs from taking down the farm, but the experience to the user would be random and undesirable. There are ways to handle lists with huge numbers of items. You have to handle this issue intentionally. For more information, see Handling Large Folders and Lists.
SharePoint is built upon SQL Server. Document libraries and SharePoint lists are stored in a database. You see this whenever you see architectural diagrams of a SharePoint installation. The actual SharePoint database isn’t particularly relevant to you as a SharePoint developer – you never directly access this database. You always use the programming interfaces to alter sites, lists, and document libraries. However, you can use that same SQL Server installation to host a database that you consume directly or via BCS, so it can be a part of the infrastructure that you use to build a SharePoint application.
Access Services allows you, with limitations, to publish Access databases to a SharePoint site. This opens up interesting possibilities for allowing SharePoint users to share data in a convenient form.
Client-Side Data Access Technologies
You can programmatically access SharePoint data from client computers. When accessing data from client computers, SharePoint uses networking technologies to send the request to SharePoint Foundation or SharePoint Server and to retrieve the results of the request from SharePoint.
Enables online and offline access to data in ECTs. You can access this object model from a Microsoft Office Word, Excel, or PowerPoint managed add-in. This is sometimes the most powerful and convenient way to access data that is external to SharePoint in an application. |
|
Enables high-performance designs where you host custom WCF services on the SharePoint server. The WCF service can access data and documents through the server object model, and allow the client to access the data and documents through the service that you implement. |
|
Enables you to customize, automate, and drive the Excel Web Access Web Part control on a page |
|
Enables you to access workbook parts or elements directly through a URL. |
|
Enables applications to calculate, set, and extract values from workbooks, and to refresh external data connections. |
|
Enables JavaScript / ECMAScript programs to access SharePoint data. This programming interface is a variant of the Managed Client Object Model. |
|
Enables .NET applications (including stand-alone applications, Silverlight applications, and ASP .NET applications) to access SharePoint data. This framework is similar to the server object model, with additional semantics that allow you to control network traffic to and from the server. It is important to know and use CAML when using the client object model. |
|
Provides a RESTful programming interface to lists, list items, and more. |
|
Provides Web service methods that you can use to work remotely with a deployment of SharePoint Foundation. |
|
Consists of a set of methods, headers, and content-types that augment HTTP/1.1 to allow for the creation and management of resource collections. SharePoint support for WebDAV allows you to upload and download documents. WebDAV (RFC 4918) is a working document of the Internet Engineering Task Force (IETF). |
Server-Side Data Access Technologies
When writing code that runs directly on the server, regardless of whether you are building a sandboxed solution or farm solution, you can specify your data queries in either CAML or using LINQ to SharePoint. CAML returns weakly-typed SPListItem objects, whereas LINQ to SharePoint returns strongly typed objects that are defined in generated code.
XML based non-procedural query language. |
|
Language-Integrated Query |
In addition to using CAML or LINQ to SharePoint to query for a set of items, you can use the server object model to directly iterate through items in a list or library. However, you should not do this unless you need to process all items in the list, and you know how many items are in the list. I often design applications to be data driven. I will design a list to contain some specific data that drives behavior. My design might be such that I always know that there are a certain number of records, and that I need to process all records in order to drive my application behavior. In this case, I would iterate directly through the items without querying using CAML or LINQ to SharePoint. Note that this same approach does not work when using the Managed Client Object Model. With the Managed Client Object Model, you must supply a CAML query when retrieving a collection of list items.
SharePoint Development compared to Traditional Rich Client Development
In a keynote speech, Steve Ballmer, CEO of Microsoft Corporation, called SharePoint Server ‘an operating system for the enterprise.’ SharePoint has much in common with an operating system:
· SharePoint has storage. Document libraries that contain hierarchies of folders are remarkably similar to files in directories in a file system.
· SharePoint has a programmable user interface.
· As with an operating system, you can write code that runs at varying levels of privilege. With SharePoint development, you can write code that needs to run with farm administrator privileges. You can write code that runs in a sandboxed solution, and you can write ECMAScript / JavaScript that runs in the client browser.
· As with an operating system, you can write services, which provide necessary infrastructure for building SharePoint applications with complex dynamics.
Scale, once again, is the biggest difference. Scale drives the programmability characteristics of SharePoint. You can write software that runs with great performance across hundreds of servers, providing an entire enterprise with a consistent experience that increases collaboration and productivity. Dealing with the issues of scalability is the price of admittance when moving from traditional application development to SharePoint development.
Languages and Platforms
One question that is at the top of all new SharePoint developer’s minds is the following: just how much do I need to learn? It is interesting to list out the languages and platforms that you need to know when doing SharePoint development. The first item in the list below is the most important. Beyond that, it depends on what you’re doing. It is not necessary to master every technology in the following list. You need to learn only what is applicable to your current task.
· C# / VB.NET / .NET Framework – You use the .NET platform in one form or another when building full-trust farm applications, sandboxed site-collection level solutions, or within a Silverlight application. You will be a more effective developer if you understand the various LINQ technologies: LINQ to XML, LINQ to Entities, LINQ to SharePoint, and LINQ to SQL.
· ASP.NET – SharePoint is an ASP.NET application hosted in IIS. It makes use of master pages and application pages, which allow you to standardize page look and feel. It also makes use of Web Part pages and Web parts, which allow users to configure their own pages. Web parts can be connected to each other so that you can create parent/child data editing capabilities or web mashup applications.
· HTML/CSS – There are a number of places in SharePoint development where it is helpful to be able to write and understand HTML and CSS.
· ECMAScript / JavaScript and the HTML Document Object Model (DOM) – ECMAScript / JavaScript is a powerful tool in your tool-chest. You can use the ECMAScript / JavaScript client object model or the OData REST API from ECMAScript / JavaScript to get at data and documents in your sites. JQuery and AJAX allow you to add rich interactivity.
· Silverlight/XAML – Silverlight is a development platform for creating engaging, interactive applications for many screens across the Web, desktop, and mobile devices. You can use the managed client object model from within the Silverlight code to read and write site data and documents. Expression Blend is an effective tool for designing Silverlight Web parts for SharePoint.
· XML – You need to know how to code a valid XML document. Regarding developing with XML, my personal recommendation is to learn and master LINQ to XML. It is a more effective way of working with XML. Knowing XSLT can be useful – you can manually write custom XSLT list views, although the primary purpose of XSLT list views is to allow you to apply interesting formatting to a list using SharePoint Designer. In other words, XSLT is more often used as the output of tooling rather than as a commonly used developer tool.
SharePoint Application Development Terms
To make it easier to talk about SharePoint application development, I’m going to define four terms (taken from the SharePoint marketing sites). I’m defining them here so that I can discuss them more easily through the remainder of the article.
SharePoint application – A SharePoint application consists of a number of customizations that taken together fills a particular market or customer need. An application consists of some combination of custom Web parts, workflows, event handlers, content types, pre-defined lists, or any of the other technologies that you use to enhance SharePoint functionality.
SharePoint capabilities – SharePoint capabilities are the key areas of SharePoint functionality. Developers build on these areas of functionality to put together a solution where the whole is more than the sum of the parts. These capabilities are in the areas of Sites, Communities, Composites, Content, Insights, and Search.
SharePoint developer scenarios – These are activities that a developer wants to enable for SharePoint users. For example, a developer may want to allow the user to generate several hundred Word documents based on data stored in a SharePoint list, generate PDF or XPS files from those documents, and to print them or send them by email. To accomplish this scenario, you will use a number of developer building blocks. One possible implementation would be to use the Open XML SDK in a Web Part that is implemented as a sandboxed solution, then use SharePoint 2010 Word Services to convert from DOCX to PDF.
SharePoint developer building blocks – These are the technologies in SharePoint that you use to do your development. Examples are Web parts, workflows, event handlers, data, and services. When you build an application, you develop using the building blocks so that the parts all work together.
Varieties of SharePoint Applications
What are the varieties of applications that SharePoint developers build? This is similar to asking the question about the varieties of applications that you can build on an operating system. Developers are creating new uses for SharePoint that cover a wide range of scenarios. Here are a few varieties of applications.
· Vertical Markets – Vendors customize SharePoint for a variety of markets such as real-estate management, resort and entertainment management, or equipment rental.
· Customized team applications – Sometimes a custom application can help a department of a large organization meet their goals in a more organized and visible manner. A testing organization could build a system to maintain a library of testing instruments and resources.
· Content Publishing Systems – These systems can be as simple as a site or site collection that is maintained by a single author. They can be as complex as a technical document generation system used by hundreds of writers, developers, and managers.
· Accounting Systems – While Microsoft does not recommend that transactional systems be implemented in SharePoint, bringing data into SharePoint from external accounting systems significantly augments the user experience.
· Management Information Systems – Some automated management systems do not have the same transactional requirements as accounting systems. You can maintain lists of customers, products, assets, and resources using SharePoint out-of-the-box, and when extended programmatically, you can provide as sophisticated of an experience as you want.
· Sales and Marketing – Many aspects of market and sales systems resemble management information systems. Integration of SharePoint with CRM systems such as Microsoft Dynamics results in powerful hybrid applications. In addition, mobile access to SharePoint sites provides road warriors with tools to interact with data necessary to do their job.
· Project management – The integration of Microsoft Project Server 2010 with SharePoint Server Enterprise provides project and portfolio management to help organizations prioritize investments, align resources and execute projects. You can develop for Project Server using its API.
While many examples of SharePoint applications fit into one of these categories, this list is certainly not complete. I’m certain that someone somewhere has written a game that runs on SharePoint that takes advantage of the collaboration features. I also would guess that someone has built a system that controls computer automated manufacturing systems using SharePoint lists, event handlers, etc. Vendors serving other vertical markets such as computer aided design or architecture will invent their own variety of enhancements of SharePoint.
SharePoint is a general purpose platform. The types of applications that you can build are nearly as varied as the types of applications that you can build for the Windows operating system.
SharePoint Capabilities
You can find a lot of information about SharePoint capabilities from the Microsoft SharePoint 2010 Product Overview. The capabilities include the following:
· Sites – You can develop and manage all of your business web sites using SharePoint 2010. SharePoint 2010 provides a full set of tools that users can use to create any kind of site. SharePoint provides infrastructure that simplifies site management.
· Communities – SharePoint 2010 provides collaboration tools that anyone can use to share ideas, find people and expertise, and locate business information. SharePoint as delivered has many collaboration capabilities, but extending SharePoint in interesting ways can make collaboration proactive instead of reactive. Integrating presence into SharePoint applications using Office Communications Server (OCS) makes it easier for colleagues to contact each other.
· Content – Publishing organizations come in a vast variety of forms – from international press organizations to a small department that is responsible for publishing documentation for a product. Organizations can use SharePoint 2010 to manage content and use Word 2010 to edit content. I further divide the content capabilities into the following three sub-categories.
· Publishing Systems – You can use SharePoint Server 2010 to manage a comprehensive publishing system. You may deliver the final product in PDF, XPS, or some other form. Open XML is an especially powerful technology that you can use to build publishing systems. You may need to write a sophisticated transformation from Open XML to other forms such as XHtml.
· Web content management – Whether using SharePoint for Internet Services to build externally facing web sites, or using SharePoint for building wikis and pages inside the firewall, SharePoint allows users to build out rich content with a minimum of effort.
· Enterprise content management – Many organizations have a vast amount of ‘organizational experience’, often in the form of documents that are managed with revisions, approval processes, and metadata.
· Search – Customizing the search experience can be a core component of making the information come alive for your users. You can customize to allow SharePoint’s search engine to search through custom documents. You can customize search to allow it to search through ECTs.
· Insights – A recent survey asked CEOs of very large companies which issues were ‘top-of-mind’ for them. BI was mentioned most often as the top priority. Excel Services and the ability to build dashboards are important for building powerful, flexible BI systems. PerformancePoint services for SharePoint provide another option to deliver customizable BI dashboards.
· Composites – Create innovative solutions that combine customer user interfaces, data access, business logic, and services. You can document and standardize business processes using workflows.
SharePoint Developer Scenarios
Many developers identify and document developer scenarios while designing software before writing functional specifications. Sometimes this process consists of the construction of ‘story boards’ that show how the user moves from point A to point B to accomplish a specific task. Sometimes you may do formal use-case analysis. You may even mock up a scenario using PowerPoint or a modeling tool. In most development organizations, you write a formal specification that outlines and details the scenario.
There are even more varieties of scenarios than there are varieties of applications. However, there are a few general types of scenarios.
· Scenarios that provide better user interfaces to existing SharePoint data. For instance, you may want to display calculated values that are based on data in several SharePoint lists.
· Scenarios that involve pulling in external data from external systems. You may be connecting to a modern ERP or CRM system, or you may be connecting to a proprietary database that is implemented on UNIX using an emulator of ancient hardware architecture.
· Scenarios around document generation. You may generate hundreds or thousands of Open XML document based on data stored in SharePoint lists or external systems, then convert to PDF, etc.
· Scenarios around process and procedure. Scenarios can be as simple as a document approval process, or can be as involved as shepherding a RFP through generating a proposal to signing of a contract.
You implement each developer scenario by using one or more SharePoint developer building blocks. Of course, as systems designers, you must determine your own scenarios. Then, your task is to be familiar with the available building blocks that you can use to implement your scenario. In many cases, you have more than one option; each option has different characteristics, and one option might suit more than another for a particular scenario. To a large extent, you probably already know the direction you need to take. A high-end marketing and design site or a luxury goods web site may from the outset plan to use Silverlight wherever necessary, whereas a part-time developer for a team site might be interested in whatever will get the job done in the fastest and easiest way.
SharePoint Developer Building Blocks
At this point, I’ve discussed what a SharePoint application is. I’ve also identified the several SharePoint capabilities that people find so valuable. I’ve discussed developer scenarios, and provided a few examples of types of scenarios. Next, I’ll cover the SharePoint developer building blocks. What do you, as a developer, actually develop when building a SharePoint application?
Important Building Blocks
While the following table is presented in alphabetical order, not all building blocks have the same importance to you. This section lists a few of the building blocks deserve to be called out separately.
· First and foremost, you need to learn about the server object model. You will use this programming interface when you are building Web parts, workflows that incorporate custom actions, event receivers, and more. Further, the managed client object model is based on the server object model. Much of what you learn about the server object model applies to the client-side object model.
· Web parts are the most common way to extend SharePoint. Learning how to build a Web Part is a great way to started in SharePoint development.
· Workflows enable you to codify and standardize business processes, and are one of the essential tools for implementing certain scenarios. If you extend workflows using code, you use the server object model.
· BCS makes data from outside SharePoint available to your SharePoint application.
· Understanding CAML and LINQ to SharePoint are key to building good SharePoint applications.
· To you as a developer, in addition to being end-user features of SharePoint Foundation, document libraries and lists are programming resources. Often, when designing a software system, you need to store configuration information that drives behavior of the application. You can store such information in hidden lists, and restrict access to users as necessary. This is most appropriate when you need to enable non-developers to maintain the application configuration. Another approach is to place configuration XML files in a hidden, access restricted document library.
The following table lists the SharePoint developer building blocks that you can use to build a SharePoint application.
Figure 2 – SharePoint 2010 Developer Building Blocks
Building Block |
Description |
|||
Publish Access databases to SharePoint |
||||
Programmatically administer SharePoint Foundation and Server |
||||
Send email or SMS |
||||
Build Web pages with .NET code-behind |
||||
Bring external data into SharePoint |
||||
Access BCS data from client computers |
||||
Declarative query language expressed as XML |
||||
Define domain definitions for data in lists and libraries. |
||||
Define prototypes for list items. |
||||
Create links, toolbar buttons, menu items |
||||
Define view for lists and document libraries |
||||
Web part for reports, charts, and KPIs |
||||
Storage for documents or files of any type |
||||
Sophisticated document categorization |
||||
Access SharePoint data from ECMAScript / JavaScript |
||||
Provide behavior when SharePoint lists or libraries are updated |
||||
Load, calculate, and display Excel workbooks |
||||
Access the Excel Web Access Web Part control from ECMAScript |
||||
Access workbook parts or elements directly through a URL |
||||
Write high-performance functions for use in server-side spreadsheets |
||||
Access Excel Services programmatically using Web services |
||||
Unit of deployment |
||||
Codify how you monitor health in a large installation |
||||
Make forms to be filled out in a browser |
||||
Use LINQ to query SharePoint lists and document libraries |
||||
User editable storage of data |
||||
Access SharePoint data from client computers |
||||
Brings SharePoint data to phones |
||||
Provides REST access to SharePoint data using the OData proposed standard. |
||||
Enhance Office clients to use SharePoint data and documents |
||||
Use Open XML for document generation and transformation |
||||
Build dashboards, scorecards, reports, and key performance indicators (KPIs) |
||||
Create business intelligence solutions |
||||
The Sandbox infrastructure isolates and shuts down bad code, preventing it from taking down the farm |
||||
Enable search through varied content, including ECTs. |
||||
Securely access legacy systems |
||||
Ensure that sensitive information is available only to authorized users |
||||
Server-side .NET API for accessing data and content |
||||
Customize the SharePoint ribbon |
||||
Create shared services that can be consumed by multiple SharePoint applications |
||||
JavaScript programming interface for putting up dialog boxes and other client-side user interface elements |
||||
Apply custom branding to a SharePoint site or site collection |
||||
Access SharePoint data through Web services |
||||
Create user interfaces that are better looking and easier to use |
||||
Create, configure, and provision SharePoint sites |
||||
User customizable pages that conserve resources |
||||
Execute code at specific times or intervals |
||||
Tailor sites for different cultures, markets, and languages |
||||
Share and view Microsoft Visio drawings |
||||
Extend Visual Studio to enable developers to create custom solutions more quickly |
||||
Upload and download files efficiently |
||||
Web parts and Web part pages enable users to customize their user interface. Building Web parts is the most common way to extend SharePoint. |
||||
Key component of building scalable, distributed, and loosely coupled SharePoint applications. |
||||
Provides claims-based identity services based on trusted providers |
||||
Provides services to convert documents to and from various file formats |
||||
Automate business processes using tasks and forms |
Access Services
You can use Access Services in Microsoft SharePoint Server 2010 to edit, update, and create linked Microsoft Access 2010 databases by using an Internet browser or the Access client. You can use SQL Server Reporting Services to produce formatted reports.
Video: The Access Show: Access 2010 demo of Access Services and web databases
SDK: Access Services administration
SDK: Using Access Services with SQL Reporting Services
Administration
The classes of the Microsoft.SharePoint.Administration namespace provide developers with tools for programmatically deploying, migrating, maintaining, and administering their SharePoint sites and SharePoint-based solutions.
SDK: SharePoint Foundation Administration
SDK: Microsoft.SharePoint.Administration Namespace
SDK: The Administrative Object Model of Microsoft SharePoint Foundation
Alerts
Alerts provide a framework for automatically sending email or SMS notifications to SharePoint users. Alerts can be attached to lists or list items. Microsoft SharePoint Foundation provides a library of alert templates for common scenarios.
SDK: Alerts in SharePoint Foundation
SDK: Alerts Overview
SDK: Alert Object Model
ASP.NET Application Pages
To build a custom user interface with specific application logic (written in C# or VB.NET in code-behind), a developer can use ASP.NET application pages (also called ASPX pages), which are a special variety of ASP.NET pages.
Your ASPX page will need to integrate with an ASP.NET master page. The relationship between master pages and ASPX pages enable you to provide a consistent user interface across SharePoint sites and site collections.
Because they are traditional ASPX pages that can contain code-behind and be precompiled, they offer some performance advantages over Site Pages.
You cannot use application pages to host Web part zones or Web parts.
One characteristic of ASPX pages is that you have a number of options about where you place Silverlight controls. For certain users, you can exclusively provide a Silverlight interface to large parts of the site, yet site maintainers can use SharePoint’s user interface.
SDK: Master Pages
SDK: Sites and Pages
MSDN: Creating Application Pages for SharePoint
SDK: Building Block: Pages and User Interface
SDK: Cascading Style Sheets Class Usage in SharePoint Foundation
Business Connectivity Services (BCS)
BCS provides infrastructure so that you can define a few methods (with specific prototypes) and bring data into SharePoint in such a way that users can view and modify that data directly from SharePoint. External tables are called External Content Types (ECTs), and sometimes entities. You can use ECTs as entities (as in entity/relationship theory).
There are three basic BCS mechanisms that you can use to bring external data into SharePoint.
· You can connect to a SQL database. SQL Server is supported out-of-the-box. With a bit of effort, you can connect to Oracle or other varieties of database servers.
· You can consume a Web Service that exposes a set of methods the follow specific patterns for the method prototypes.
· You can write .NET managed code (C# or VB) to connect to any variety of data. There are two ways that you can extend through code:
· You can write a .NET Assembly Connector to allow users to create ECTs to a set of predefined schemas. The schemas can’t change without recompiling and redeploying.
· If you are building upon an underlying system that contains its own schema mechanism and definitions, you can write a Custom Connector that uses the underlying schema definition and allows users to create ECTs for any table in the underlying schema. This is, of course, more work than writing a .NET Assembly Connector.
External lists and external data columns are part of built-in user interface functionality that allows you to show and maintain data in ECTs. You can create external lists either using the Web interface, SharePoint Designer, or Visual Studio 2010.
You can expose your ECTs to the search engine, so that users can find data in them. By default you display data in a profile page. You can customize the page, or customize what happens when a user clicks on an item in the search results. For example, you could use a non-SharePoint website to display and maintain the item.
SDK: Business Connectivity Services Overview
SDK: Microsoft Business Connectivity Services
SDK: Business Connectivity Services: How-tos and Walkthroughs
SDK: Differences Between Using the .NET Assembly Connector and Writing a Custom Connector
How to: Create External Lists in SharePoint
How to: Create an External Content Type Based on a SQL Server Table
How to: Connect to an Oracle Database Using Business Connectivity Services
How to: Create a SharePoint List with External Data Columns
Visual how-to: Creating SharePoint 2010 Web Parts That Can Read and Write Data to External Data Sources
Walkthrough: Creating an External List in SharePoint by Using Business Data
Video and hands-on lab: Accessing External Data with Business Connectivity Services in SharePoint 2010
Blog: Walkthrough of creating a SharePoint 2010 external list using Visual Studio 2010
Blog: Searching External Data in SharePoint 2010 Using Business Connectivity Services
Business Connectivity Services Client-Side API
Using the BCS Client-Side API, you can create applications that have CRUD functionality for an ECT. When building Microsoft Office managed add-ins, a convenient way to present the user interface is via task or action panes. This allows your users to interact with BCS data while continuing to work in their document or spreadsheet.
BCS Client-Side API provides a means for client applications to access data from BCS. Further, you can configure BCS so that the data can be taken off-line. When the client computer comes online again, changes are synchronized through BCS, using conflict resolution if necessary. BCS Client-Side API is most often used from within an Office 2010 client managed add-in, although it can be used from any .NET application.
You can take the data offline so that your users can continue to review and modify the data in a cache. If an offline user modifies data in such a way that it conflicts with modifications made by another user, you can write code to resolve those conflicts, and present appropriate options to your users.
SDK: Creating Advanced Code-Based Solutions Using Business Connectivity Services
How to: Show External Data in Word Using Content Controls
Blog: Overview of BCS Advanced Code-Based Solutions
Collaborative Application Markup Language (CAML)
Collaborative Application Markup Language (CAML) is an XML based query language that allows you to specify filters, sort order, and more. You can specify exactly which fields in each item you want to retrieve. This allows you to control the size of the query results.
While there are certain circumstances where you can use LINQ to SharePoint instead of CAML for querying, CAML is still relevant in SharePoint 2010. You use CAML when querying using the managed client object model. When using the managed client object model, if you filter list items using LINQ instead of CAML, in the underlying system, the filtering happens after all items have been returned. This can result in using more CPU and memory resources on the server than necessary.
SDK: Collaborative Application Markup Language Core Schemas
SDK: Introduction to Collaborative Application Markup Language (CAML)
Column and Field Types
Column and field types allow you to define rich metadata for standardized fields and columns in SharePoint lists. You can define a site column (in a site column gallery) of a specific data type that you can use throughout your site. This is similar to defining domains in database schema design. It allows you to ensure that columns in several lists use the same value space.
SDK: Custom Field Types
SDK: Site Columns
Content Types
You can define a content type that is a prototype of a list item. If you are using content types for a list, you can define that the list contain only items of one content type, or you can define that it can contain items of one of several content types.
SDK: Content Types
SDK: Introduction to Content Types
Custom Actions
A custom action represents a link, toolbar button, menu item, or any control that can be added to a toolbar or menu that appears in the UI. You define custom actions by using a custom action element within a Feature definition file. You can bind custom actions to a list type, content type, file type, or programmatic identifier (ProgID).
SDK: Custom Action Element Type
How to: Modify the User Interface Using Custom Actions
Custom Views
Defining custom views for SharePoint lists is a key tool in your toolkit. You can programmatically define custom views for specific users or scenarios so that data is presented in the most convenient form. A common use of custom views is to define the format of data for exporting to a spreadsheet for further processing.
Note: A View in this context is different from a view in the context of SQL Server. In SQL Server, a view is a database construct that defines a view into a table. In this context, a view is a visible table presented in a page so that users can see some specific subset of the data in a SharePoint list.
Office online: Create or change a view
SDK: SP.View Class
Dashboards and KPIs
A dashboard is a solution for information workers that consolidates personal, team, corporate, or external information, and provides single-click access to analytical and collaborative tools. It brings an integrated view of a company's data resources to an individual's desktop, providing access to key business information.
Getting Started: Introduction to the Business Intelligence Center
Office Online: Getting started with dashboards
Office Online: KPIs and Status Indicators
SDK: Development Scenarios with PerformancePoint Services
Document Libraries
SharePoint document libraries are special forms of SharePoint lists. They contain features such as the capability to keep major and minor versions of documents. They can restrict access to documents based on identity. You can define any number of columns that contain auxiliary information about each document in the library.
A very important feature of document libraries is that you can bind columnar data to metadata in the document. When you check the document out of the library, the metadata is copied to the document, where it can be maintained by the user. When the document is checked back into the document library, the updated metadata is copied back into the fields in the item in the document library.
Document libraries can contain files of any variety. Document libraries can contain nested folders – this makes a document library resemble a file system.
SDK: Files and Documents
Document Metadata
Document metadata is custom data that SharePoint stores for each document in a document library. Your users can specify this data using the SharePoint Web user interface or using Microsoft Word. You can programmatically set this data in an event handler as documents are added to a document library. Your users can then filter and find documents using this data. In addition, you can access this metadata in a SharePoint workflow, and alter workflow behavior based on metadata. You typically define document metadata using Content Types. Workflows can interact with this data.
A document information panel is a form that is displayed within the client application, and which contains fields for the document metadata. Document information panels enable users to enter important metadata about a file anytime they want, without having to leave the client application.
SDK: Metadata Navigation and Filtering
SDK: Document Information Panel Overview
ECMAScript / JavaScript Client Object Model
The ECMAScript / JavaScript Client Object Model is a variant of the managed client object model that you can use from ECMAScript / JavaScript. You use the same methods and data types. The same programming model applies. As with the managed client object model, you control when you send network traffic to and from the server.
SDK: Managed Client Object Model
SDK: Differences Between Managed and ECMAScript Object Models
Event Receivers
Event receivers enable you to write event handlers that are called when items are added, deleted, or modified in a SharePoint document library or list, as well as at other times. Event handlers can be deployed either as a full-trust farm solution, or as a sandboxed solution.
Video: How Do I: Create Event Receivers for SharePoint 2010 in Visual Studio 2010
SDK: Building Block: Event Handling
SDK: Events in SharePoint Foundation 2010
SDK: Introduction to Events in SharePoint Foundation 2010
SDK: Walkthrough: Add Feature Event Receivers
SDK: SPEventReceiverDefinition Class
Excel Services
Excel Services enables users to load, calculate, and display Excel workbooks on Microsoft Office SharePoint Server 2010. There are four primary programmatic interfaces for Excel Services.
· Excel Web Access is a viewer page and an Excel Services Web Part that you can add to any Web parts page in SharePoint Server 2010. Excel Web Access renders (in other words, creates the HTML for) live Excel workbooks on a Web page, and enables the user to interact with those workbooks.
· Excel Web Services for programmatic access
· An JavaScript object model for automating and customizing, and to drive the Excel Web Access control and help build more compelling, integrated solutions
· A Representational State Transfer (REST) API for accessing workbook parts directly through a URL
To further customize spreadsheets, you can extend Excel Calculation Services by creating user-defined functions (UDFs).
Office Online: Excel Services
SDK: Excel Web Access
SDK: Excel Web Services
SDK: Excel Services ECMAScript (JavaScript, JScript)
SDK: Getting Started with Excel Services
SDK: Excel Services Development Roadmap
Excel Services ECMAScript Interface
The ECMAScript object model in Excel Services enables you to write code to automate, customize, and interact with the Excel Web Access Web Part control on a page. By using the ECMAScript object model, you can build mashups and other integrated solutions that interact with Excel Web Access Web Part controls. It also enables you to add more capabilities to your workbooks.
SDK: Excel Services ECMAScript (JavaScript, JScript)
Excel Services REST API
The Excel Services REST API provides programmatic access to workbook parts or elements directly through a URL.
Excel Services User Defined Functions (UDF)
Excel Services User Defined Functions (UDF) enables you to write high-performance functions in C or C++ for use in server-side spreadsheets.
SDK: Excel Services User Defined Functions
Excel Web Services
You can use Excel Web services to access Excel Services programmatically.
SDK: Excel Web Services
Features
Features are a unit of deployment for SharePoint. Deploying a Feature in a large farm ensures that the artifacts in the Features are installed on all servers. Features can contain templates, pages, list definitions, event handlers, workflows, JavaScript source files, CSS files, and more. Features can contain Feature Receivers, which are event handlers that run when the Feature is installed, uninstalled, activated, deactivated, or upgraded.
SDK: Using Features
SDK: Walkthrough: Add Feature Event Receivers
Health Rules
SharePoint Health Analyzer monitors the health of SharePoint Foundation throughout a server farm by applying a set of health rules. A health rule is executable code that is deployed in a compiled assembly at the server farm level and registered with SharePoint Health Analyzer. When a rule is registered, a timer job is created to run the rule. An item for the rule is then added to the Health Analyzer Rule list under Review rule definitions in the Monitoring section of Central Administration.
SDK: Building Block: Health Rules
SDK: SharePoint Health Analyzer
InfoPath Forms Services
InfoPath Forms Services is a server technology that makes it possible for people to fill out forms in a Web browser. By managing forms in a central location, you can streamline business processes and improve relations with customers, partners, and suppliers.
Developer Center: InfoPath Developer Center
Office Online: Getting started with InfoPath 2010
TechNet: Plan InfoPath Forms Services
LINQ to SharePoint
LINQ to SharePoint is a LINQ query provider that enables you to write queries more naturally than when using CAML. It is most useful when using the SharePoint server object model.
One important characteristic of LINQ to SharePoint is that it uses an approach of generated code so that your code uses a strongly-typed object model for accessing the data returned by a query.
For developers interested in functional programming, LINQ to SharePoint serves as a data source for doing pure functional transformations.
SDK: Managing Data with LINQ to SharePoint
Video and hands-on lab: Accessing SharePoint 2010 Data with Server-Side APIs
Blog: Query Composition using Functional Programming Techniques in C# 3.0
Lists
Custom lists in a SharePoint site provide a place to store data. Using SharePoint lists to contain data that you access programmatically is a very important building block for developers. In the section, SharePoint Development vs. Database Application Development, I describe how you can use SharePoint lists for parts of your database.
SDK: Building Block: Lists and Document Libraries
SDK: SharePoint List Data Model
Managed Client Object Model
The Managed Client Object Model provides access to SharePoint data from external .NET applications. This API is sometimes called the client-side object model (CSOM).
The managed client object model has three basic uses:
· Managed .NET application – You can use the managed client object model from most .NET applications, including rich client applications running on a user’s computer, or as part of a .NET server application. You could write a WPF real-estate management application that runs on a client computer and pulls information from a SharePoint server using the managed client object model. You could also enhance a traditional ASP.NET application to pull data using the client object model.
· Silverlight Web Part – Code within a Silverlight control can use the client object model.
· HTML Web Part – You can use a JavaScript version of the client object model. It has exactly the same semantics, except that you use a JavaScript programming interface.
Alert: When you are using the managed client object model to query for items in a list, you should always form your queries using CAML, not LINQ. If you use LINQ, there is a performance hit that is relational to the total number of items in the list. In contrast, when using the server object model, we recommend using LINQ to SharePoint instead of CAML.
A common activity for client-side code is to upload and download documents and files to and from SharePoint document libraries. In the managed client object model, the ClientOM.File.OpenBinaryDirect method and the ClientOM.File.SaveBinaryDirect method use WebDAV for uploading and downloading files. Without building your own custom WCF service, WebDAV is the most efficient way to upload and download files.
SDK: Managed Client Object Model
Technical Article: Using the SharePoint Foundation 2010 Managed Client Object Model
Technical Article: Using the SharePoint Foundation 2010 Managed Client Object Model with the Open XML SDK 2.0
Video and hands-on lab: Accessing SharePoint 2010 Data with Client-Side APIs
Mobile Pages, Controls, and Adaptors
SharePoint Foundation provides a set of mobile pages and mobile controls that is separate from the pages and controls that you see from desktop and laptop computers. Mobile browsers can access certain Web parts by means of mobile Web Part adapters.
SDK: Building Block: Mobile Pages, Controls, and Adapters
OData REST APIs
SharePoint 2010 publishes data as resources that are addressable by URIs using the OData protocol. Data is accessed and changed by using standard HTTP verbs of GET, PUT, POST, and DELETE. OData uses the entity-relationship conventions of the Entity Data Model to expose resources as sets of entities that are related by associations.
SDK: SharePoint Foundation REST Interface
Office Client Managed Add-Ins
Office Client managed add-ins are the way that you can extend the Office client applications and integrate them more deeply with SharePoint Foundation and SharePoint Server. Building Office client managed add-ins is an effective way to make the features of your SharePoint application discoverable and easy to use for end users. Deep integration of SharePoint data with Word documents or Excel spreadsheets results in an application where you have only one version of your critical data, helping to prevent decisions based on stale data.
You can access SharePoint external content types through the BCS client-side API. You can access data and documents stored in SharePoint lists and documents using the managed client object model.
Developer Center: Office Developers Center
Open XML SDK
Most SharePoint users make extensive use of document libraries, and most documents in document libraries are stored in the Open XML file format. Prior to the advent of Open XML, it was difficult to write code that directly accessed the contents of documents, but with the Open XML SDK, you have server-hardened tools to query and transform Open XML document. Using Open XML from within a SharePoint application opens up new scenarios. You can generate large numbers of documents, and automatically convert those documents from one format to another. You can query the contents of existing documents and bring that content and data to your users in new and interesting ways. For example, a product design team might use a specific document template for specifications, and each section of the specification may follow a convention that reports the state of the specification. You could then write an application to process all specifications for a project, and generate a report for management that shows the overall state of the specification writing process.
Combining the power of the Open XML SDK with the power of Word Services, you can implement a large number of server-side scenarios with high performance.
Prior to the advent of Open XML, customers sometimes attempted to solve server-side document processing needs using Office automation. Automating Microsoft Office applications on servers presents a set of well-known issues. The solution is to use SharePoint 2010 and the Open XML SDK.
A common pattern for document generation in SharePoint 2010 is to generate them into a SharePoint document library. Then, if necessary, you can use Word Automation Services to update fields in the document, or to import altChunk content.
Developer Center: Open XML Formats Resource Center
External link: ECMA 376-2
External link: ISO/IEC 29500-2
KB article: Considerations for server-side Automation of Office
Blog: Eric White's Blog
Blog: Brian Jones’ Blog
Blog: How to Use altChunk for Document Assembly
PerformancePoint Services
PerformancePoint Services in Microsoft SharePoint Server 2010 is a performance management service that you can use to monitor and analyze your business. It provides tools for building dashboards, scorecards, reports, and key performance indicators (KPIs). Integrated analytics help employees move quickly from monitoring information to analyzing it and, when appropriate, sharing it throughout the organization.
SDK: Development Scenarios with PerformancePoint Services
PowerPivot
PowerPivot gives users the power to create compelling self-service BI solutions, facilitates sharing and collaboration on user-generated BI solutions, and enables IT organizations to increase operational efficiencies through Microsoft SQL Server 2008 R2-based management tools.
MSDN: PowerPivot Overview
External: PowerPivot.com
Sandboxed Solutions
Sandboxed solutions are one approach to solving scalability problems when SharePoint users need to have specialized solutions built. If every developer knew all best practices, followed them religiously, and always wrote perfect code, this wouldn’t be a problem. However, code is not perfect, and bugs in code that runs with farm administrator rights can bring down the farm. With sandboxed solutions, there is an infrastructure that watches code for thrown exceptions, and monitors memory and CPU use, among other things. The misbehaving code gets stopped, and not the farm.
SDK: Sandboxed Solutions
How to: Creating Sandboxed Workflow Actions.
Video and hands-on lab: Sandboxed Solutions for Web Parts in SharePoint 2010
Search Customization
You can customize search to index new and different types of content, including ECTs.
SDK: SharePoint Enterprise Search
Technical Article: Searching External Data in SharePoint 2010 Using Business Connectivity Services
Secure Store Service
Secure Store Service is a claims-aware authorization service that provides storage and mapping of credentials such as account names and passwords. It enables you to securely store data that provides credentials required for connecting to external systems and associating those credentials to a specific identity or group of identities.
SDK: Secure Store Service
How to: Use Secure Store Service to Connect to an External System
Security
Security features of SharePoint Foundation 2010, and the underlying ASP.NET and .NET Framework, help give you protection from unauthorized changes to your data, whether deliberate or inadvertent, and help ensure that sensitive information is available only to those authorized to see it.
SDK: SharePoint Foundation Security
Server Object Model
The SharePoint server object model allows you to write programs to access SharePoint lists and document libraries, site collections, sites, and a lot more. Although the object model is very large, it is not inherently difficult.
When you are developing for SharePoint, things can become somewhat complex. You may be developing a Web part, an event receiver, or code that runs as part of a workflow. In all of these scenarios, you will be writing code that uses the server object model. This means that your edit/compile/execute cycle will be more complex. With each compilation, you may need to reinstall a SharePoint Feature, cycle Internet Information Services, or connect to another process for debugging. Dealing with those issues while at the same time learning how the server object model works is not desirable. Instead, while I was learning the server object model, I built small console applications that used the server object model. I executed those console applications directly on the server. When writing more complex code that would eventually end up in a Web part, I factored the code so that the code that used the server object model was isolated in one or a few classes in my application. I factored code that used the Open XML SDK into its own set of classes. This gave me a quick edit/compile/execute cycle for both the Open XML code and the server object model code. Then, after all constituent parts are developed, it is easy to build and deploy a Web part that uses the debugged code.
Code that uses the SharePoint server object model can run with farm administrator privileges or as a sandboxed solution. With sandboxed solutions, you have access to a subset of the API that is available to code that is running with farm administrator rights.
The SharePoint server object model can be divided into three hierarchies:
· The Content Hierarchy of Microsoft SharePoint Foundation discusses the various classes that represent publishable items of data, such as list items. There are also classes that represent nested containers of data, such as lists, content databases, Web sites, collections of Web sites, and groupings of site collections called Web applications.
· The Physical Objects Hierarchy of Microsoft SharePoint Foundation discusses the various classes that represent physical entities, such as servers and files, and containers of such entities, such as farms and folders.
· The Services Hierarchy of Microsoft SharePoint Foundation discusses classes that represent Web services, Windows services, other types of services, and instances of services.
SDK: Server and Site Architecture: Object Model Overview
SDK: Essential SharePoint Programming Tasks
SDK: Using the SharePoint Foundation Server-Side Object Model
SDK: Digital Asset Management Programming Model
SDK: Document Management Programming Model
SDK: Records Management Programming Model
SDK: Metadata and Taxonomy Programming Model
SDK: Publishing Programming Model
SDK: Sandboxed Solutions
Video and hands-on lab: Accessing SharePoint 2010 Data with Server-Side APIs
Server Ribbon
Customizing the SharePoint 2010 Server ribbon allows you to give an intuitive and powerful user interface to your SharePoint application. The key point behind customizing the ribbon is to make features and capabilities of your custom SharePoint application discoverable to your users. Customizing the ribbon is analogous to customizing the ribbon for the Office client applications.
SDK: Building Block: Server Ribbon
SDK: Server Ribbon in SharePoint Foundation
SDK: Architecture of the Server Ribbon
SDK: Customizing the Server Ribbon
Video and hands-on lab: Creating Dialogs and Ribbon Controls for SharePoint 2010
Service Application Architecture
The service application architecture enables you to create robust and scalable shared services that can be consumed by multiple SharePoint applications.
SDK: Service Application Framework
SDK: Service Application Framework Architecture
Video: SharePoint 2010 Service Application Architecture
Video: Creating Custom Service Applications
SharePoint Dialog Framework
When building web parts or application pages, you may need to put up a dialog box of one sort or another.
SDK: Creating a Page for a Modal Dialog Box
Video: SharePoint 2010 UI Features
Blog: How to Display a SharePoint Dialog from Ribbon Button and Get Selected Item Context
Video and hands-on lab: Creating Dialogs and Ribbon Controls for SharePoint 2010
SharePoint Themes
Themes, which are important when branding a SharePoint site, provide a quick and easy way to apply colors and fonts to sites in SharePoint 2010. A change in theme cause the color of most page elements, such as background images, text, and hyperlinks, to change. The fonts used for some page elements, such as titles, also changes.
TechNet: SharePoint Themes
SharePoint Web Services
SharePoint has long provided a set of Web services to enable client interaction with SharePoint deployments. Some of these are specifically designed for data retrieval and others include some data retrieval services. The APIs of these data-providing Web services are still supported for backward compatibility and interoperability with Web service clients. For reasons of both performance and ease, we recommend that you use either the client object model or the ADO.NET Data Services Framework to query SharePoint data.
SDK: SharePoint Foundation 2010 Web Services
SDK: Lists Web service
SDK: Webs Web service
SDK: WebSvcsites Web service
SDK: SiteData Web service
SDK: DspSts Web service
Interoperability documentation: SharePoint Products and Technologies Protocols
Instead of using Web services, see the following:
SDK: SharePoint Foundation REST Interface
SDK: Managed Client Object Model
Technical Article: Using the SharePoint Foundation 2010 Managed Client Object Model
Technical Article: Using the SharePoint Foundation 2010 Managed Client Object Model with the Open XML SDK 2.0
Video and hands-on lab: Accessing SharePoint 2010 Data with Client-Side APIs
Silverlight Web Part
Silverlight Web parts are an important tool for building the best user interfaces. There are times when nothing less than Silverlight will do.
Code Sample: Silverlight List Viewer
Video and hands-on lab: Creating Silverlight User Interfaces for SharePoint 2010 Solutions
Site Definitions
A site definition is a set of files that includes a master XML configuration file that is stored on all front-end Web servers. A site definition provides the basic blueprint for how sites look, what lists they include, their default navigational structures, and so on.
SDK: Site Types: WebTemplates and Site Definitions
Site Pages
Site Pages provide an efficient means (in terms of both storage and CPU time) to allow for hundreds of thousands of Web pages where many are the same and a few are customized. Unlike a traditional ASP.NET application, a physical ASPX page does not need to exist for every site page on the server. SharePoint treats any site page that is not customized as a virtual file, which can allow a small number of files to appear in many places. This is one of the many aspects of SharePoint that gives it scalability. Without this capability, you would need far too many compiled ASPX pages for a large site. Management of those pages would be unwieldy.
SDK: Sites and Pages
Blog: Creating a SharePoint Site Page With Code-Behind Using Visual Studio 2010
Timer Jobs
Like a CRON job, a timer job is code that runs at a specific time. An application may regularly need to process data in a SharePoint list, and perhaps modify data in an external system. The developer can write a timer job for this that will run at 1am every morning.
SDK: Timer job reference
Variations
Variations enable you to tailor sites for different cultures, markets, and languages. It is a feature that facilitates serving different content to different audiences. Variations can help serve different content based on the language of the user. In addition, variations can serve different content based on end-user devices, or any arbitrary distinction that you choose, such as brand or level of user expertise.
SDK: Variations and Multiple Languages Sites
Blog: Variations in SharePoint 2010
Visio Services
Visio Services is a service application that enables users to share and view Microsoft Visio Web drawings. The service also enables data-connected Microsoft Visio 2010 Web drawings to be refreshed and updated from various data sources.
Visual Studio SharePoint Tools Extensibility
The SharePoint tools in Visual Studio 2010 meet the requirements of many application development scenarios. However, you might discover cases where they do not provide functionality that you or other developers require. In these cases, you can extend the SharePoint tools to create the functionality that you need.
SDK: Visual Studio SharePoint Tools Extensibility
Video: Getting Started with SharePoint 2010 Developer Tools in Visual Studio 2010
Web-based Distributed Authoring and Versioning (WebDAV)
A common activity for client-side code is to upload and download documents and files. You may need to retrieve documents from a SharePoint document library to the client computer, or upload documents from the client computer to a SharePoint document library. You can use WebDAV directly, but an easy way to use WebDAV is to use the managed client object model. The ClientOM.File.OpenBinaryDirect method and the ClientOM.File.SaveBinaryDirect method in the client object model use WebDAV for uploading and downloading files. Without building your own custom WCF service, WebDAV is the most efficient way to upload and download files. Note that WebDAV is limited to accessing files, not data.
External link: RFC 4918
Web Parts
SharePoint is an ASP.NET application. It inherits a number of important aspects of ASP.NET, including the notions of web part pages, and web parts. The classes that represent SharePoint Web parts derive from the appropriate ASP.NET classes.
Building SharePoint web parts accounts for more SharePoint developer hours than any other category (perhaps more than the rest put together). Today, more than ever, users expect good looking, intuitive, and powerful user interfaces, and developing web parts is often the most effective approach.
Web parts can communicate with other web parts. For example, they can be linked to enable parent/child form/list user interfaces when maintaining data.
AJAX Web parts are a special category. When your optimal user interface requires it, you can take advantage of AJAX architecture.
Silverlight Web parts are another special category. There are times when nothing less than Silverlight will do. I think that Silverlight web parts in SharePoint are the future.
Web parts can be built with code-behind, either in sandboxed or full-trust mode.
On the client side, web parts can communicate with the SharePoint server using the Managed Client Object Model, REST APIs, or web services. WCF is an option from within a Silverlight web part.
While developers can build custom Web parts, SharePoint 2010 provides a number of build-in Web parts that can be useful in putting together a custom solution:
Some of the more common SharePoint built-in Web parts are:
List View Web Part |
SDK: List Views Blog: SharePoint 2010 List View Blog Series Office online: About the List View Web Part |
Image Web Part |
Office online: Image Web Part |
Site Users Web Part |
Office online: Site Users Web Part |
Chart Web Parts |
Office online: Introduction to the Chart Web Part |
SDK: Web Parts in SharePoint Foundation
SDK: Microsoft.SharePoint.WebPartPages Namespace
SDK: Building Block: Web Parts
SDK: Connect Web Parts in SharePoint 2010
SDK: JS Grid Control
How to: Create a Basic JS Grid
Video and hands-on lab: Getting Started Building Web Parts in SharePoint 2010
Video and hands-on lab: Building Blocks for Web Part Development in SharePoint 2010
Video and hands-on lab: Creating Silverlight User Interfaces for SharePoint 2010 Solutions
Video and hands-on lab: Sandboxed Solutions for Web Parts in SharePoint 2010
Video: Creating SharePoint 2010 Web Parts That Can Read and Write Data to External Data Sources
Video: Advanced Web Part Development in SharePoint 2010
SDK: Cascading Style Sheets Class Usage in SharePoint Foundation
Code Sample: Silverlight List Viewer
Web Services
When you are building large distributed applications, best practice is to loosely couple them, using ASMX web services or WCF services to do the coupling. You need to apply this same technique when building large scale SharePoint applications.
As an example, Operational Research often requires deployment of a sophisticated mathematical optimizer to arrive at an optimal or near optimal solution to some problem. This should be deployed on dedicated hardware, and exposed via Web services.
In some cases, you may want to build client applications that make use of sophisticated server-side functionality that scales to the maximum extent. You may want to reduce extraneous network traffic to an absolute minimum. In these cases, the best solution often is to host a WCF service on your SharePoint server. Code in this service can use the server object model with full farm privileges, and supply the necessary functionality for the client application. As appropriate, when building these types of services, you need to do attack surface analysis and threat modeling.
Developer Center: WCF Developers Center
Blog: Getting Started Building a WCF Web Service
Windows Identity Foundation
The claims-based identity model for Microsoft SharePoint Foundation 2010 and Microsoft SharePoint Server 2010 is built upon Windows Identity Foundation (WIF). Features of claims-based identity include:
· Authentication across users of Windows-based systems and systems that are not Windows-based.
· Multiple authentication types.
· Stronger real-time authentication.
· A wider set of principal types.
· Delegation of user identity between applications.
When you build claims-aware applications, the user presents an identity to your application as a set of claims. One claim could be the user’s name, another might be an email address. The idea is that an external identity system is configured to give your application all the information that it needs about the user with each request, along with cryptographic assurance that the identity data that your application receives comes from a trusted source. Under this model, single sign-on is much easier to achieve.
Developer Center: SharePoint 2010 Security Resource Center
Developer Center: Windows Identity Foundation
Blog: Consuming a Claims-Enabled WCF Web Service as a SharePoint 2010 External Content Type
Word Automation Services
There are some tasks that are difficult when using the Open XML SDK, such as repagination, conversion to other document formats such as PDF, or updating of field codes or the table of contents, fields, and other dynamic content in documents. Word Automation Services is a feature of SharePoint 2010 that can help in these scenarios. It is a shared service that provides unattended, server-side conversion of documents into other formats, and some other important pieces of functionality. It was designed from the outset to work on servers and can process high volumes of documents in a reliable and predictable manner.
Technical Article: Developing with SharePoint 2010 Word Automation Services
Workflows
SharePoint workflows allow you to codify business process. Workflow logic can be very simple or quite elaborate. End users can use workflows to build no-code business solutions. Developers can enhance workflows with C# code that is called at appropriate times. Workflows can be deployed either as a full-trust farm solution, or as a sandboxed solution. Examples of workflow use include claims processing, content approval, or purchasing processes.
SDK: Workflows in SharePoint Foundation
SDK: Microsoft.SharePoint.Workflow
Walkthrough: Use SharePoint Full-Trust Workflow Activities with Business Connectivity Services.
Video and hands-on lab: Developing Business Processes with SharePoint 2010 Workflows
Developer Dashboard
Developing SharePoint applications can be a fairly complex undertaking. If a page or a Web part does not perform well, it can be difficult to determine what is causing the delay or consuming resources. SharePoint 2010 provides a developer dashboard that you can turn on to view performance metrics related to the page that is loading.
You can turn on the developer dashboard by running the following Stsadm command:
stsadm -o setproperty -pn developer-dashboard -pv OnDemand
SDK: SharePoint 2010 Development for ASP.NET Developers
SDK: Using the Developer Dashboard
Accessibility
Microsoft adopted the Web Content Accessibility Guidelines 2.0 (WCAG 2.0) for SharePoint 2010, and set a goal for Level AA. Becoming a W3C recommendation on December 11th, 2008, WCAG 2.0 defines the expectations of and the techniques deployed in well-built, accessible Web sites.
External link: Web Content Accessibility Guidelines 2.0
Blog: Accessibility and SharePoint 2010
SharePoint Development Tools
There are a number of tools that you use to build SharePoint 2010 applications.
Visual Studio 2010 |
Visual Studio 2010 is the primary tool for professional developers on SharePoint 2010. It contains a variety of pre-configured project types to make it as easy as possible to write code for your scenario. |
SharePoint Designer 2010 |
SharePoint Designer 2010 enables you to create no-code SharePoint solutions that encompass a variety of common scenarios, from collaborative sites and web publishing to Line-Of-Business data integration, business intelligence solutions, and human workflows. Developers can use SharePoint Designer 2010 to get a quick start on SharePoint development projects. |
Visio 2010 |
Visio 2010 enables you and subject matter experts to author SharePoint workflows using drag-and-drop. You can then import them into SharePoint Designer 2010 for further editing, and then execute them in SharePoint 2010. |
SDK: SharePoint Foundation Development Tools
MSDN: SharePoint Development in Visual Studio
MSDN Magazine: Visual Studio 2010 Tools for SharePoint Development
Video: Getting Started with SharePoint 2010 Developer Tools in Visual Studio 2010
Download: Microsoft SharePoint Designer 2010 (32 bit)
Blog: SharePoint Workflow Authoring in Visio Premium 2010
Blog: Visual Studio SharePoint Development Blog
Setting up a Development Environment
There are several ways to set up a SharePoint 2010 development environment.
· My favorite approach is to use Windows Server 2008 R2, and set up my development machine using Hyper-V. Immediately after installing everything, I take a snapshot. This allows me to revert back to this clean state if necessary, although in my experience, it rarely is. For the best experience, place the virtual hard drive on a drive other than where the host operating system resides.
· You can install on Windows Server 2008 (or R2) that is running directly on the server, not in a Hyper-V VM. This can be an effective approach, although it loses the ability to revert to a snapshot.
· You can install on Windows 7 64-bit or Windows Vista 64-bit. Some developers work for companies where they are prevented by policy from running server operating systems, so this can be a good solution. In addition, if I were starting a long development project that would take several months to complete, I would install SharePoint 2010 on my laptop so that I could do development at opportune times, yet retain the ease of use of an end-user operating system.
SDK: Setting up a SharePoint 2010 Development Environment.
Blog post: SharePoint development environments
Application Lifecycle Management (ALM)
Application Lifecycle Management is the coordination of all aspects of software engineering—including the formulation and communication of business and technical requirements, code design and architecture, project tracking, change management, coding, testing, debugging, and release management—by using tools that facilitate and track collaboration among and within work teams.
Resource Center: Application Lifecycle Management Resource Center
Video and hands-on lab: Development Life Cycle for SharePoint 2010
Video: Improving Software Development Across the Lifecycle with Visual Studio 2010
Conclusion
With SharePoint Foundation 2010 and SharePoint Server 2010, SharePoint has evolved into a comprehensive development platform. While many SharePoint applications are simple, SharePoint applications can very complex, using a large number of building blocks, all working together in concert. Careful design of your application is necessary to ensure that your application is robust and can scale, and that the user interface of your application meets the needs of your users.
Additional Resources
Code samples: SharePoint Server 2010 Code Samples
Code samples: SharePoint Foundation 2010 Code Samples
SDK: Best Practices with SharePoint Server
Articles: SharePoint 2010 Technical Articles
Videos: SharePoint 2010 Videos | SharePoint Conference 2009
Video and hands-on lab: What Developers Need to Know About SharePoint 2010
Blog: SharePoint Team Blog
Blog: Microsoft SharePoint Developer Documentation Team Blog
MSDN: Developer Getting Started Training
MSDN: Advanced Developer Training
Microsoft Training and Certification for SharePoint 2010
Comments
Anonymous
October 26, 2010
Thanks for the excellent post Eric. I've a question - Can I use the Javascript version of the client object model in traditional ASP.NET applications?Anonymous
October 27, 2010
The comment has been removedAnonymous
November 08, 2010
Thank you for a nice article. I got a question. Q : Can I use any of these(Silverlight and Javascript) client side Object Model over a mobile device application? If yes, which one and which platform OS of mobile? Kindly revert...Anonymous
February 15, 2012
Today<a href="www.binaryrepublik.com/"><b>SharePoint Consulting</b></a> were very popular and their advisors to provide their best service for the business organizations.