Your SlideShare is downloading. ×
  • Like
Client Object Model - SharePoint Extreme 2012
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Client Object Model - SharePoint Extreme 2012

  • 850 views
Published

T

T

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
850
On SlideShare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
17
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • צל דקה 15
  • <script type="text/ecmascript" src="/_layouts/SP.Core.js" /> <script type="text/ecmascript" src="/_layouts/SP.Debug.js" /> <script type="text/ecmascript" src="/_layouts/SP.Runtime.Debug.js" />
  • ScriptLink = master page, every page. Not available in sandbox…script. Src = load every timeDynamic load= בודק האם הסקריפט כבר טעון, טוב בווב-פארטBody.onload?
  • צל דקה 40
  • סיום – דקה 30פתיחת דף קיים עם dataview, שמציג ULהוספת קישור לקובץ JS החיצוניהוספת AHREF עם שם הפונקציה והפנייה ללינקהוספת href<a href="javascript:add2f('{@RestaurantName}', this)" style="margin-top:10px;">3. הוספת הלינקים: <script type="text/javascript" src="../../SiteAssets/Before/Extreme.js" /> <script type="text/ecmascript" src="/_layouts/SP.Core.js" /> <script type="text/ecmascript" src="/_layouts/SP.Debug.js" /> <script type="text/ecmascript" src="/_layouts/SP.Runtime.Debug.js" /> 4. תוכן/// <reference name="MicrosoftAjax.js" />/// <reference path="C:\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\14\\TEMPLATE\\LAYOUTS\\SP.debug.js" />var context = null;varclientContext = null; var web = null; varcurrentUser = null; var Restaurants = null;varoList = null;varrestNameToAdd = "";varuserName = null;function add2f(restName, sourceName) { // Get the user namerestNameToAdd = restName; // 1. get current user context = SP.ClientContext.get_current(); web = context.get_web();currentUser = web.get_currentUser();currentUser.retrieve(); context.load(web);context.executeQueryAsync(Function.createDelegate(this, this.onSuccessUserMethod),Function.createDelegate(this, this.onFailureUserMethod)); }function onSuccessUserMethod(sender, args) { // get my sitevaruserObject = web.get_currentUser();userName = userObject.get_loginName().toString().replace("CONTOSO\\\\", "");clientContext = new SP.ClientContext('/my/personal/' + userName);varoWebsite = clientContext.get_web();varcollList = oWebsite.get_lists();this.oList = collList.getByTitle('Restaurants');clientContext.load(oList);varlistItemInfo = new SP.ListItemCreationInformation(); // add the item to the listvarlistItem = oList.addItem(listItemInfo); // Assign Values for fieldslistItem.set_item('Title', restNameToAdd);listItem.update();clientContext.executeQueryAsync(Function.createDelegate(this, this.onAddSucceeded), Function.createDelegate(this, this.onAddFailed)); /*clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));*/}function onFailureUserMethod(sender, args) { alert('onFailureUserMethod failed ' + args.get_message() + '\\n' + args.get_stackTrace()); }function onAddSucceeded() {var res = SP.UI.Notify.addNotification("Added resturant " + restNameToAdd + " to your favourites list", true); }function onAddFailed(sender, args) { alert("add failed. Message:" + args.get_message());}
  • New elements: article, aside, audio, bdo, canvas, command, datalist, details, embed, figcaption, figure, footer, header, hgroup, keygen, mark, meter, nav, output, progress, rp, rt, ruby, section, source, summary, time, video, wbr New types of form controls: dates and times, email, url, search, number, range, tel, color[53] New attributes: charset (on meta), async (on script) Global attributes (that can be applied for every element): id, tabindex, hidden, data-* (custom data attributes) Deprecated elements will be dropped altogether: acronym, applet, basefont, big, center, dir, font, frame, frameset, isindex, noframes, strike, tt
  • New elements: article, aside, audio, bdo, canvas, command, datalist, details, embed, figcaption, figure, footer, header, hgroup, keygen, mark, meter, nav, output, progress, rp, rt, ruby, section, source, summary, time, video, wbr New types of form controls: dates and times, email, url, search, number, range, tel, color[53] New attributes: charset (on meta), async (on script) Global attributes (that can be applied for every element): id, tabindex, hidden, data-* (custom data attributes) Deprecated elements will be dropped altogether: acronym, applet, basefont, big, center, dir, font, frame, frameset, isindex, noframes, strike, tt
  • צ"ל דקה 55יצירת masterpage חדש והוספת התגיתבדף, שינוי ה- master page:MasterPageFile="../../_catalogs/masterpage/v4html5.master" 3. הוספת canvas
  • התחלה – דקה 70
  • התחלה – דקה 70
  • התחלה- דקה 75הכי חשוב ExecuteOrDelayUntilScriptLoaded(loadSharePointPictures, 'sp.js'); יצירת דף מתוך המאסטר שתומך ב- HTML5.הוספת קישורים ל- JQM:תמונות נמצאות בספריית התמונות (images).מבנה הדף: page, list, conte
  • פתיחתsolution קיים עם אאוטלוקיצירת השליפה של הפריטים:חיבוריצירת siteאיתור כל הרשימותשליפת הרשימה יצירת אחרי הפיתוח של השליפה, להריץ ולהראות שהנתונים נשלפויצירת booking – איך שולפים משתמש
  • דקה 18
  • התחלה- דקה 75הכי חשוב ExecuteOrDelayUntilScriptLoaded(loadSharePointPictures, 'sp.js'); יצירת דף מתוך המאסטר שתומך ב- HTML5.הוספת קישורים ל- JQM:תמונות נמצאות בספריית התמונות (images).מבנה הדף: page, list, conte

Transcript

  • 1. Using ClientObjectModel Daniel Plocker CTO, Advantech
  • 2. Agenda • Client Object Model overview • ECMA Script Client OM • Extending SP with HTML 5 • Going Mobile • .Net Managed Client
  • 3. WhyClientOM? Client side integration between SharePoint and existing Office or LOB apps simplifies day-to-day activities. Richer, smoother and more intuitive user experience. Better multi-platform support.
  • 4. TheBasics  Client-side library for remotely calling SharePoint  Mirrors (a subset) of objects on the server  Usable in JavaScript, .net CLR, Silverlight CLR  Requests are batched for over- the-wire performance  Used by SharePoint UI for operations like batch deletion
  • 5. EquivalentObjects
  • 6. 3 thingsto know 1. ClientContext is the central object clientContext = new ClientContext(“http://mysite”); 2. Before you read a property, you have to ask for it clientContext.Load(list); 3. All requests must be committed in a batch clientContext.ExecuteQuery();
  • 7. AccessingData withClient OM client server
  • 8. Client ObjectModelLimitations  Client object model cannot be used on server to talk to same-server  You still need to handle synch/update semantics (change log could help)  No elevation of privilege capabilities  Requests are throttled  .net CLR has sync method; Silverlight CLR and Jscript are async
  • 9. JavaScriptClientobjectmodel
  • 10. JavaScriptClientOM  JavaScript Client OM is easily added to a SharePoint ASPX page - reference:  _layouts/sp.js  Add this using <SharePoint:ScriptLink>  All libraries crunched for performance  Use un-crunched *.debug.js files with debug mode  Method signatures can be different compared to .NET and Silverlight  Different data value types
  • 11. JavaScriptClientOM  C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14TEMPLATELAYOUTS  SP.js (SP.debug.js)  380KB (559KB)  SP.Core.js (SP.Core.debug.js)  13KB (20KB)  SP.Runtime.js (SP.Runtime.debug.js)  68KB (108KB)
  • 12. JavaScriptinSharePoint2010
  • 13. JavaScriptClientOM
  • 14. Fluent UIStatus BarandNotificationArea
  • 15. DEMO
  • 16. Items notcovered byCSOM  User Profiles  People  Search  Enterprise Metadata  Excel REST web services  Publishing  Administration
  • 17. HTML 5  <HTML>  <CANVAS>  <VIDEO>  <INPUT>  <AUDIO>  <COMMAND>  <DATALIST>  <TIME>
  • 18. HTML 5 –Getting itWorking  <HTML> tag  Internet Explorer 9 compatibility  <meta http-equiv="X-UA-Compatible" content="IE=9"/>  Potential issues and workarounds
  • 19. DEMO
  • 20. GoingMobilewithJQuery  jQuery is a cross-browser JavaScript library designed to simplify the client- side scripting of HTML  $("div.test").add("p.quote").addClass("bl ue").slideDown("slow");  $.each([1,2,3], function(){ … }  jQuery Mobile is a touch-optimized web framework
  • 21. GoingMobilewithSharePoint  Built-in mobile view with &mobile=1  You can customize the mobile view and master page.  To take advantage of JQuery Mobile:  Create a simple master page, HTML5 valid  Add script links  To use with client OM, don’t forget ExecuteOrDelayUntilScriptLoaded
  • 22. DEMO
  • 23. NET Clientobjectmodel
  • 24. .Net CLRClientOM  Provides easy access from remote .NET clients to manipulate SharePoint data  Can be utilized from managed code - also from office clients etc.  Assemblies  Microsoft.SharePoint.Client.dll (281kb)  Microsoft.SharePoint.Client.Runtime.dll (145kb)
  • 25. .Net CLRClientOM
  • 26. DEMO
  • 27. Questions?
  • 28. Summery  Client OM  3 Flavors  Batch processing  .Net Managed Client  Integration with LoB  ECMAScript Client OM  Simplify UI  Basis for client-side programming  HTML5 and Mobile  Enable HTML5  Use JQuery
  • 29. ThankYou!