• Like
  • 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.

SharePoint 2010 Client-side Object Model

  • 2,710 views
Uploaded on

 

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

Views

Total Views
2,710
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

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

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