Learn about the various SharePoint 2013 APIs, CSOM, SOM, OData/REST and WCF Data Services, and how to call them from your web applications, line-of-business systems, and back-end services, to leverage all the power of SharePoint 2013 without having to target and deploy code into SharePoint 2013.
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
SharePoint 2013 APIs
1. SharePoint 2013 APIs
Leverage SharePoint 2013 from websites,
LOB systems and back-end services
2. Agenda
• Intro
• APIs and Integration Points
• REST/oData
• CSOM
• JavaScript
• SOM
• Conclusion
3. Thank you to my sponsor
• http://www.cloudshare.com/
4. Intro
Who am I?
• .NET / SharePoint solution architect
• Over 18 years experience developing business solutions for
private industry & government
• Recent clients include Justice Canada, NRC, NSERC,
DFAIT, CFPSA, OSFI, MCC
• Specialize in Microsoft technologies
• Speaker at user groups and conferences
5. Development Models
• As a service
Web / Phone / Desktop / Server / Mashup
• As a framework
SharePoint Web Page
App Model
Farm Solution
Sandbox Solution
5
6. Client Protocols
Browser Windows ASP.NET
Workflows
Event
Receivers
[7] Application
[4] Transport
[3] Network
Industry
Standard
OSI
Model
Microsoft
Open
Specification
9. Development IDEs & Languages
• Any web or cloud IDE
• “Napa” Cloud-Based Development
• SharePoint Designer
HTML, CSS, JavaScript
• Visual Studio
.NET, etc
• PowerGUI or any PS command shell
PowerShell
9
11. Coding to SP APIs
• Server App Model
CSOM, oData/REST, JavaScript
• Server Object Model (SOM)
SPSite site = new SPSite("http://localhost/")
• Web Services
http://localhost/_vti_bin/Lists.asmx
11
12. Web Dev
• Using .NET, JavaScript, PHP, Ruby, etc
• Address an oData / REST end point
• Address CSOM .NET API
• Address CSOM JavaScript API
• Address CSOM Silverlight API
12
14. oData (.NET)
Uri u =
new Uri("http://localhost/_vti_bin/ListData.svc/", UriKind.Absolute);
TeamSiteDataContext ctx = new TeamSiteDataContext(u);
ctx.Credentials = System.Net.CredentialCache.DefaultCredentials;
DataServiceQuery<DocumentsItem> qry = ctx.Documents;
IEnumerable<DocumentsItem> docs = qry.Execute();
14
15. JavaScript API
var context = SP.ClientContext.get_current();
var user = context.get_web().get_currentUser();
$(document).ready(function () {
getUserName();
});
function getUserName() {
context.load(user);
context.executeQueryAsync(onSuccess, onFailure);
}
16. .NET Desktop Dev
• Using WPF/WCF, WinForms or Silverlight
• Address an oData / REST end point
• Address CSOM or SOM .NET API
• Address Silverlight API
16
17. Client-Side Object Model (.NET)
using (ClientContext ctx = new ClientContext("http://localhost/"))
{
Web web = ctx.Web;
ListCollection lists = web.Lists;
List list = web.Lists.GetByTitle(libraryname);
CamlQuery qry = new CamlQuery();
ListItemCollection items = list.GetItems(qry);
ctx.Load(items, li => li.Include(pi => pi["LinkFilename"]));
ctx.ExecuteQuery();
return items;
}
17
18. Server Object Model (.NET)
using (SPSite site = new SPSite("http://localhost/"))
{
using (SPWeb web = site.RootWeb)
{
SPList list = web.Lists["Documents"];
SPListItemCollection items = list.Items;
return items;
}
}
18
19. SharePoint Farm Dev
• Using .NET and HTML/CSS/JavaScript
• Use webparts
• Address SOM .NET API
• Address an oData / REST end point
19
20. Resources for Attendees
• SharePoint 2013 development overview (MSDN)
• What’s new for developers in SharePoint 2013
• Choose the right API set in SharePoint 2013 (MSDN)
• SPC407 - Deep dive into the SharePoint 2013 CSOM API's
(Microsoft SharePoint Conference 2012)
21
21. Contact Me
• John Calvert, Chief Architect
• Software Craft, Inc.
• john at softwarecraft dot ca
• softwarecraft dot ca
• at softwarecraft99
Notes de l'éditeur
Session will combine:
short presentation by me
interactive discussion about the role and importance of a business analyst on SharePoint projects
You are encouraged to contribute your comments and to ask questions at any point
Let’s make this as interactive as possible
Hopefully we will each of us learn some new ideas
As a service : means code that calls SharePoint APIs but is not deployed in SharePoint.
As a framework : means code that is deployed inside or by SharePoint.
App Model is a special case, it is deployed either off-SharePoint or in an isolated-subdomain inside SharePoint.
Credit: Microsoft SharePoint Conference 2012 - SPC407 - Deep dive into the SharePoint 2013 CSOM API's
http://channel9.msdn.com/Events/SharePoint-Conference/2014/SPC407
OSI Model
http://en.wikipedia.org/wiki/OSI_model
Credit: Microsoft SharePoint Conference 2012 - SPC407 - Deep dive into the SharePoint 2013 CSOM API's
Find your project type in the unbolded black type to see what your choices are for SharePoint development
Choose the right API set in SharePoint 2013 - http://msdn.microsoft.com/en-us/library/jj164060.aspx
Microsoft “Napa” Office 365 Development Tools is a cloud-based development IDE for building Apps for MS Office or MS SharePoint
sign up for an Office 365 Developer Site
install Napa Office 365 Development Tools on your Office 365 Developer site
you are ready to create apps for Office documents, mail items or SharePoint
Other IDEs:
Microsoft WebMatrix - http://www.microsoft.com/web/webmatrix/
Microsoft Lightswitch - http://msdn.microsoft.com/en-us/vstudio/ff796201.aspx
Any web or cloud dev IDE
Choose the right API set in SharePoint 2013 - http://msdn.microsoft.com/en-us/library/jj164060.aspx
Deprecated and not recommended:
ASP.NET (asmx) web services
direct Remote Procedure Calls (RPC) calls to the owssvr.dll file
Choose the right API set in SharePoint 2013 - http://msdn.microsoft.com/en-us/library/jj164060.aspx
Deprecated and not recommended:
ASP.NET (asmx) web services
direct Remote Procedure Calls (RPC) calls to the owssvr.dll file
SharePoint 2013 REST API, endpoints, and samples - http://msdn.microsoft.com/en-us/library/office/jj860569.aspx