• Save

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

SharePoint 2010 Client-side Object Model

on

  • 3,428 views

 

Statistics

Views

Total Views
3,428
Views on SlideShare
3,428
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

SharePoint 2010 Client-side Object Model Presentation Transcript

  • 1. SharePoint 2010 Client Side Object Model
    Phil Wicklund
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 2. About Me?
    About Me: Over 6 years of experience SharePoint Architecture Experience, trained SharePoint architecture and development classes for nationally renown SharePoint-focused training organization.
    Training & Certifications:
    • MCTIP: SharePoint 2010 Administration
    • 3. MCPD: SharePoint 2010 Development
    • 4. Microsoft’s SharePoint Masters Training (Redmond, WA)
    Other Notable Experience:
    • Published Author on SharePoint 2010 (SharePoint 2010 Workflows in Action)
    • 5. National Speaker at SharePoint Conferences (The Experts Conference-LA, SharePoint Technology Conference-San Fran, TechFuse-MN, SharePoint Saturdays)
    • 6. SharePoint Blog: www.philwicklund.com
  • Agenda
    Introduction / Why COM?
    COM Architecture
    Coding Samples
    DEMO
    .NET COM
    Questions
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 7. Intro to the SP 2010 COM
    Not enough web services in SP 2007
    Rather than create more services, COM provides the complete API
    COM provides a consistent development experience:
    Windows Applications
    ASP.NET web sites
    Silverlight Applications
    JavaScript, www client side scripting
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 8. COM Architecture
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 9. Assembly References
    SharePoint, Server Side
    Microsoft.SharePoint (ISAPI)
    .NET clients
    Microsoft.SharePoint.Client (ISAPI)
    Silverlight clients
    Microsoft.SharePoint.Client.Silverlight (Layouts/clientbin)
    Javascript clients
    SP.js & SP.Core.js (Layouts)
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 10. Comparable Objects
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 11. Starter Code
    Using Microsoft.SharePoint.Client;
    ...
    using (ClientContext context = new ClientContext("http://intranet"))
    {
    Web web = context.Web;
    context.Load(web);
    context.ExecuteQuery();
    string title = web.Title;
    // ListCollection lists = web.Lists;
    }
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 12. Iterating through Lists in a Web
    using (ClientContext context = new ClientContext("http://intranet"))
    {
    Web web = context.Web;
    context.Load(web);
    context.Load(web.Lists);
    context.ExecuteQuery();
    foreach(List list in web.Lists)
    {
    //do something
    }
    }
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 13. Efficiencies… Don’t be Lazy!
    Web web = context.Web;
    context.Load(web, wprop => wprop.Title));
    ListCollection lists = web.Lists;
    IEnumerable<List> filtered = context.
    LoadQuery(lists.Include(l=>l.Title));
    context.ExecuteQuery();
    foreach(List list in filtered)
    { }
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 14. Working with List Items
    Web web = context.Web;
    List list = context.Web.Lists.
    GetByTitle(“List Title");
    CamlQuery query = CamlQuery.CreateAllItemsQuery();
    ListItemCollection items = lst.GetItems(query);
    context.Load(items);
    context.ExecuteQuery();
    foreach (ListItem item in items)
    {
    string title = item["Title"];
    }
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 15. Efficencies with List Items
    CamlQuery query = new CamlQuery();
    query.ViewXml = "<View><Query><Where><Eq>
    <FieldRef Name='Title'/><Value Type='Text'>Phil</Value>
    </Eq></Where></Query></View>";
    ListItemCollection items = list.GetItems(query);
    context.Load(items, x => x.Include(
    item => item["ID"],
    item => item["Title"],
    item => item.DisplayName));
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 16. Adding new List Items
    List list = context.Web.Lists.
    GetByTitle(“List Title");
    context.Load(list);
    ListItemnewItem = list.AddItem(new ListItemCreationInformation());
    newItem["Title"] = "My new item";
    newItem.Update();
    context.ExecuteQuery();
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 17. Silverlight & Asynchronous Calls
    private void Button_Click(object sender, RoutedEventArgs e)
    {
    // Load a bunch of stuff
    clientContext.ExecuteQueryAsync(success, failure);
    }
    private void success(object sender, ClientRequestSucceededEventArgsargs)
    {
    RunQueryrunQuery= Run;
    this.Dispatcher.BeginInvoke(runQuery);
    }
    private delegate void RunQuery();
    private void Run() { /* do something */ }
    private void failure(object sender, ClientRequestFailedEventArgsargs) { /* do something */ }
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 18. .NET – COM Demo
    Build a Console (client) Application
    Render all theList Titles from a remoteSharePoint site.
    Create a new list itemin a remote SharePointsite.
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 19. Questions & Comments
    Phil Wicklund
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAConsulting.com