SharePoint 2013JavaScript Object Model
Blog: mushannak.blogspot.ae
Twitter: @MuShannak
LinkedIn: linkedin.com/in/shannak
Slideshare:
slideshare.net/MuawiyahShannak
Website: mushannak-public.sharepoint.com
Muawiyah ShannakSharePoint Architect, MCC & UAE-
SPUG Organizer
JOIN THE COMMUNITY @UAESharePoint
KNOWLEDGE
SHARE
BE CONNECTE
D
Email : [email protected]
Website : uaesharepoint.org
Facebook: http://www.facebook.com/UAESharepoint
Twitter : @UAESharePoint
YouTube: http://www.youtube.com/UAESharePoint
LinkedIn: linkedin.com/groups/UAESharePoint-
4759377n
January, 2013
Online and in class sessions
20 Organizers, Speaker and
Contributor
Around 500 social media followers
Register Microsoft technical
Community
Logistics
• Questions and Interactions• Related to subject questions• Detailed questions• Questions channels : social media and our email
• Presentation & Code
• Recording
Agenda• CSOM intro
• How CSOM works
• CSOM Advantages
• Read list data and query
• Add/Update/Delete list
Items
What is CSOM• Client-Side Object Model
• API Used to develop remote applications (runs outside of SharePoint Server) Designed to be similar to the Server Object Model Introduced in SharePoint 2010, expanded in SharePoint 2013
• Three implementations .Net managed Silverlight (Plus Mobile) JavaScript (Ecmascript/JSOM)
• One Web service /_vti_bin/Client.svc
• Uses asynchronous patterns & Communication with SP done in batches
CSOM API
• .NET ManagedMicrosot.Sharepoint.Client.*.dll located in <15 hive>\ISAPI
• Silverlight Microsot.Sharepoint.Client.*.Sliverlight.dll located in <15 hive>\TEMPLATE\LAYOUTS\ClientBin
• PhoneMicrosot.Sharepoint.Client.*.Phone.dll located in <15 hive>\TEMPLATE\LAYOUTS\ClientBin
• JavaScriptSP.*.js located in <15 hive>\TEMPLATE\LAYOUTS
How Client-Side Object Model (CSOM) Work
XML
JSON
Server OMClient.svc
SharePoint ServerClient
JavaScript/Silverlight
Phone
.NET
CSOM Coverage
Sites & Webs Lists & Items Fields & Content Types Views & Forms Files & Folders Pages & Web Parts Features Security (Users, Groups, Roles,
Permissions) Navigation Recycle Bin Utilities
User Profiles Publishing Feeds & Sharing Search Taxonomy IRM E-Discovery Workflow Analytics BCS Language & regional
settings
SharePoint JavaScript CSOM
• SharePoint JavaScript CSOM, aka: SharePoint JSOM: JavaScript Object Model SharePoint ECMASecript
• A JavaScript libraires, running in the client browsers Microsoft Internet Explorer 7 and greater Firefox 3.5 and greater Safari 4.0 and greater
JSOM Code life cycleInitiate SP Context
Defined the required objects
Load objects
Execute Request (executeQueryAsync)
Handle Response (Success, Failure)
JSOM - Hello worldDemo
Get list items
• Get all list items and fields
• Get all list items and specific fields
Query list items
Query list items Demo
Add, Edit and Delete list item
• Edit list item
• Delete list item
• Add new item
Add, Edit and Delete list Items
Demo
CSOM is critical part of App Model
SharePoint apps cannot run any server-side code