2. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
Server APIs
Remote / Client APIs
SharePoint Standard APIs
REST APIs SOAP APIsCSOM
Data Platform
Farm Site List Data External Lists
Server OM LINQ to SharePoint
Server-side
Client-side
3. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
AGENDA
1. REST/OData
2. Client-Side Object Model
3. SOAP Web Service
4. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
REST/OData란?
• REpresentational State Transfer
• Web Service 기반의 Open Data Protocol(Odata) 를 사용
• 네트워크 시스템을 위한 비표준 아키텍쳐 스타일
• 모든 Resource는 유일한 URI로 데이터와 서비스
• http://<site url>/_api/web/lists
• http://<site url>/_api/web/lists/getByTitle('ListTitle')
• Resource는 일반적 인터페이스(HTTP GET, POST, PUT, DELETE)로 접근
• 결과 값은 ATOM or JSON 을 사용
6. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
REST Operations
HTTP POST
• Create Data In Data Source
HTTP GET
• Read Data from Data Source
HTTP PUT
• Update Data In Data Source
HTTP DELETE
• Delete Data In data Source
7. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
• URI와 HTTP Method 만으로도 쉽게 의미 전달이 가능하다.
• JavaScript , jQuery를 사용하여 높은 개발 생산성
• Web Developers 개발하기 익숙하다.
• SOAP보단 개발하기 단순하다.
• 결과 값은 ATOM or JSON 을 사용한다.
SharePoint REST API 장점
8. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
http://<Server>/_api/web/lists/getByTitle(‘Customer')/getItemByStringId(‘1’)?$select=Title, ID
SharePoint Host
Service
Resource Path Query Options
Structure
9. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
OData Query Operators
Operators Descriptions Examples
Lt Less than http://<server>/_api/web/lists/getByTitle('test')/items?&$filter=Id lt 1
Le Less equal http://<server>/_api/web/lists/getByTitle('test')/items?&$filter=Id le 1
Gt Greater than http://<server>/_api/web/lists/getByTitle('test')/items?&$filter=Id gt 1
Ge Greater equal http://<server>/_api/web/lists/getByTitle('test')/items?&$filter=Id ge 1
Eq Equal http://<server>/_api/web/lists/getByTitle('test')/items?&$filter=Id eq 1
startsWith startswith(GUID,‘11’) http://<server>/_api/web/lists/getByTitle('test')/items?$filter=startswith(GUID, ‘11')
Substringof substringof('Cr',Title) http://<server>/_api/web/lists/getByTitle('test')/items?$filter=substringof(GUID, ‘11')
Eq Equal http://<server>/_api/web/lists/getByTitle('test')/items?&$filter=Title eq ‘1’
Ne Not equal http://<server>/_api/web/lists/getByTitle('test')/items?&$filter=Title lt ‘1’
Day() Day http://<server>/_api/web/lists/getByTitle('test')/items?&$filter=Id lt 1
Month() Month http://<server>/_api/web/lists/getByTitle('test')/items?&$filter=Id lt 1
Year() Year http://<server>/_api/web/lists/getByTitle('test')/items?&$filter=Id lt 1
Minute() Minute http://<server>/_api/web/lists/getByTitle('test')/items?&$filter=Id lt 1
Second() Second http://<server>/_api/web/lists/getByTitle('test')/items?&$filter=Id lt 1
11. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
AGENDA
1. REST/OData
2. Client-Side Object Model
3. SOAP Web Service
12. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
Client-Side Object Model 란?
• Microsoft SharePoint Client API
• SharePoint Server Object Model 과 유사
• Site, Web, ContextType, List, Folder, Navigation…
• .NET Managed, Silverlight, ECMAScript 사용 가능
• SharePoint 2010 버전 부터 사용 가능
14. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
• SharePoint Developers 개발하기 익숙하다.
• Client Application 개발에 용이하다.
• LINQ, CAML Query 사용이 가능하다.
• RPC Batch Processing
• clientContext.Load(Web);
clientContext.ExecuteQueryAsync(succeedcallback, failcallback);
SharePoint CSOM 장점
15. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
Server
(Microsoft.SharePoint)
.NET Managed
(Microsoft.SharePoint.Client)
Silverlight
(Microsoft.SharePoint.Client.Silve
rlight)
JavaScript
(SP.js)
SPContext ClientContext ClientContext ClientContext
SPSite Site Site Site
SPWeb Web Web Web
SPList List List List
SPListItem ListItem ListItem ListItem
SPFiled Field Field Field
Client Object Modal - Objects
16. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
Object OM Location Names
Managed ISAPI folder Microsoft.SharePoint.Client.dll
Microsoft.SharePoint.Client.Runtime.dll
Silverlight LayoutsClientBin Microsoft.SharePoint.Client.Silverlight.dll
Microsoft.SharePoint.Client.Silverlight.Runtime.dll
JavaScript Layouts SP.js
Client Library
17. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
CSOM(ECMAScript) Code Demo
• 그룹 권한 추가
var currentCTX = new SP.ClientContext("/Conference");
var currentWeb = currentCTX.get_web();
// Create Group information for Group
var membersFC = new SP.GroupCreationInformation();
membersFC.set_title("컨퍼런스 읽기 그룹");
membersFC.set_description('SharePoint 컨퍼런스 방문자 그룹입니다.');
//add group
oMembersFC = currentWeb.get_siteGroups().add(membersFC);
//return SP.RoleDefinition object /Full Control, Contribute, Read
var rdFC = currentWeb.get_roleDefinitions().getByName('읽기');
// Create a new RoleDefinitionBindingCollection.
var bindingFC = SP.RoleDefinitionBindingCollection.newObject(currentCTX);
// Add the role to the collection.
bindingFC.add(rdFC);
// Get the RoleAssignmentCollection for the target web.
var assignments = currentWeb.get_roleAssignments();
// assign the group to the new RoleDefinitionBindingCollection.
var roleAssignmentFullControl = assignments.add(oMembersFC, bindingFC);
currentCTX.load(oMembersFC);
//Execute Query
currentCTX.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this,
this.onQueryFailed));
function onQuerySucceeded() { alert("Created Group."); }
function onQueryFailed(sender, args) { alert('Request failed. ' + args.get_message() + 'n' + args.get_stackTrace()); }
18. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
AGENDA
1. REST/OData
2. Client-Side Object Model
3. SOAP Web Service
19. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
SOAP 란?
• Simple Object Access Protocol(SOAP)
• Created By Microsoft in 1998 /W3C Standard
• RPC Model을 사용
• 표준화된 XML 메시징을 사용
• 하드웨어, 소프트웨어, 프로그래밍 언어에 독립적
• 프록시와 방화벽에 구애 받지 않고 쉽게 통신 가능
20. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
SOAP 구성도
Register(WSDL)Find(WSDL)
SOAP
UDDI
Service Requester Service Provider
Service Broker
UDDI(Universal Description, Discovery, and Integration)
• 프로그래밍이 가능한 공개된 레지스트리의 역할
WSDL(Web Services Description Language)
• 웹서비스가 제공하는 서비스에 어떤 파라미터를 가지고 있어야 하는지, 어떤 값을 리턴하는지 설명하는 XML
파일
22. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
SharePoint 2007 and 2010 Web Service
SharePoint 2007 SharePoint 2010
Web Service WSS 3.0 MOSS Foundation SP2010
Alerts V V V V
Authentication V V V V
Copy V V V V
Forms V V V V
Lists V V V V
Meetings V V V V
People V V V V
Permissions V V V V
SiteData V V V V
Sites V V V V
SpellChecker V V V V
23. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
SharePoint 2007 and 2010 Web Service
SharePoint 2007 SharePoint 2010
Web Service WSS 3.0 MOSS Foundation SP2010
User and Groups V V V V
Versions V V V V
Views V V V V
WebPartPages V V V V
Webs V V V V
PublishedLinksService V V
Search V V
UserProfielService V V
Workflow V V
Diagnostics V V
SocialDataService V
TaxonomyClientService V
24. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
Web Service URL
Class Name
Operations
Namespace
Visual Studio Service Reference
25. SharePoint Korea Conference 2013 Smart한 SharePoint 개발
Reference
• Get started with the SharePoint 2013 REST service
• http://msdn.microsoft.com/en-us/library/fp142380.aspx
• Choose the right API set in SharePoint 2013
• http://msdn.microsoft.com/en-us/library/jj164060.aspx
• Get Some REST : SharePoint 2013 REST API's
• http://www.slideshare.net/eshupps/taking-advantage-of-the-sharepoint-2013-rest-api
• Use OData query operations in SharePoint REST requests
• http://msdn.microsoft.com/en-us/library/fp142385.aspx#bk_architecture
• Add a SOAP service as a data source
• http://office.microsoft.com/en-us/sharepoint-designer-help/add-a-soap-service-as-a-
data-source-HA010355752.aspx
• jQuery Library for SharePoint Web Services
• http://spservices.codeplex.com/wikipage?title=%24%28%29.SPServices&referringTitle=%24
%28%29.SPServices&ANCHOR#GeneralSyntax
• 기본 XML Web Services
• http://msdn.microsoft.com/ko-kr/library/ms996507.aspx