SlideShare uma empresa Scribd logo
1 de 16
SHAREPOINT 2010
CLIENT SIDE OBJECT
MODEL
Phil Wicklund
SharePoint FREEWARE
www.PhilWicklund.com
SharePoint CONSULTING
www.RBAconsulting.com
About Me?
Training & Certifications:
• MCTIP: SharePoint 2010 Administration
• MCPD: SharePoint 2010 Development
• Microsoft’s SharePoint Masters Training (Redmond, WA)
Other Notable Experience:
• Published Author on SharePoint 2010 (SharePoint 2010 Workflows in
Action)
• National Speaker at SharePoint Conferences (The Experts Conference-LA,
SharePoint Technology Conference-San Fran, TechFuse-MN,
SharePoint Saturdays)
• SharePoint Blog: www.philwicklund.com
About Me: Over 6 years of experience SharePoint Architecture Experience, trained
SharePoint architecture and development classes for nationally renown SharePoint-
focused training organization.
Agenda
 Introduction / Why COM?
 COM Architecture
 Coding Samples
 DEMO
 .NET COM
 Questions
SharePoint FREEWARE
www.PhilWicklund.com
SharePoint CONSULTING
www.RBAconsulting.com
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
COM Architecture
SharePoint FREEWARE
www.PhilWicklund.com
SharePoint CONSULTING
www.RBAconsulting.com
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
Comparable Objects
Microsoft.SharePoint Client Object Models
SPContext ClientContext
SPSite Site
SPWeb Web
SPList List
SPListItem ListItem
SPField Field
SPFile File
SharePoint FREEWARE
www.PhilWicklund.com
SharePoint CONSULTING
www.RBAconsulting.com
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
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
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
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
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
Adding new List Items
List list = context.Web.Lists.
GetByTitle(“List Title");
context.Load(list);
ListItem newItem = list.AddItem(new
ListItemCreationInformation());
newItem["Title"] = "My new item";
newItem.Update();
context.ExecuteQuery();
SharePoint FREEWARE
www.PhilWicklund.com
SharePoint CONSULTING
www.RBAconsulting.com
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,
ClientRequestSucceededEventArgs args)
{
RunQuery runQuery= Run;
this.Dispatcher.BeginInvoke(runQuery);
}
private delegate void RunQuery();
private void Run() { /* do something */ }
private void failure(object sender,
ClientRequestFailedEventArgs args) { /* do something */ }
SharePoint FREEWARE
www.PhilWicklund.com
SharePoint CONSULTING
www.RBAconsulting.com
.NET – COM Demo
 Build a Console (client) Application
 Render all the
List Titles from a remote
SharePoint site.
 Create a new list item
in a remote SharePoint
site.
SharePoint FREEWARE
www.PhilWicklund.com
SharePoint CONSULTING
www.RBAconsulting.com
QUESTIONS & COMMENTS
Phil Wicklund
SharePoint FREEWARE
www.PhilWicklund.com
SharePoint CONSULTING
www.RBAConsulting.com

Mais conteúdo relacionado

Mais procurados

Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
SPTechCon
 
Taking Advantage of the SharePoint 2013 REST API
Taking Advantage of the SharePoint 2013 REST APITaking Advantage of the SharePoint 2013 REST API
Taking Advantage of the SharePoint 2013 REST API
Eric Shupps
 
Are you getting Sleepy. REST in SharePoint Apps
Are you getting Sleepy. REST in SharePoint AppsAre you getting Sleepy. REST in SharePoint Apps
Are you getting Sleepy. REST in SharePoint Apps
Liam Cleary [MVP]
 
SharePoint 2013 REST API & Remote Authentication
SharePoint 2013 REST API & Remote AuthenticationSharePoint 2013 REST API & Remote Authentication
SharePoint 2013 REST API & Remote Authentication
Adil Ansari
 
SharePoint 2007 Presentation
SharePoint 2007 PresentationSharePoint 2007 Presentation
SharePoint 2007 Presentation
Ajay Jain
 
Asp.net server controls
Asp.net server controlsAsp.net server controls
Asp.net server controls
Raed Aldahdooh
 
Toms introtospring mvc
Toms introtospring mvcToms introtospring mvc
Toms introtospring mvc
Guo Albert
 

Mais procurados (20)

Introduction to the SharePoint 2013 REST API
Introduction to the SharePoint 2013 REST APIIntroduction to the SharePoint 2013 REST API
Introduction to the SharePoint 2013 REST API
 
Understanding and programming the SharePoint REST API
Understanding and programming the SharePoint REST APIUnderstanding and programming the SharePoint REST API
Understanding and programming the SharePoint REST API
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
 
Taking Advantage of the SharePoint 2013 REST API
Taking Advantage of the SharePoint 2013 REST APITaking Advantage of the SharePoint 2013 REST API
Taking Advantage of the SharePoint 2013 REST API
 
SharePoint Client Object Model (CSOM)
SharePoint Client Object Model (CSOM)SharePoint Client Object Model (CSOM)
SharePoint Client Object Model (CSOM)
 
SharePoint 2013 REST APIs
SharePoint 2013 REST APIsSharePoint 2013 REST APIs
SharePoint 2013 REST APIs
 
Are you getting Sleepy. REST in SharePoint Apps
Are you getting Sleepy. REST in SharePoint AppsAre you getting Sleepy. REST in SharePoint Apps
Are you getting Sleepy. REST in SharePoint Apps
 
SharePoint 2013 REST API & Remote Authentication
SharePoint 2013 REST API & Remote AuthenticationSharePoint 2013 REST API & Remote Authentication
SharePoint 2013 REST API & Remote Authentication
 
Develop iOS and Android apps with SharePoint/Office 365
Develop iOS and Android apps with SharePoint/Office 365Develop iOS and Android apps with SharePoint/Office 365
Develop iOS and Android apps with SharePoint/Office 365
 
SharePoint 2007 Presentation
SharePoint 2007 PresentationSharePoint 2007 Presentation
SharePoint 2007 Presentation
 
Sharepoint Online
Sharepoint OnlineSharepoint Online
Sharepoint Online
 
Who Are You and What Do You Want? Working with OAuth in SharePoint 2013.
Who Are You and What Do You Want? Working with OAuth in SharePoint 2013.Who Are You and What Do You Want? Working with OAuth in SharePoint 2013.
Who Are You and What Do You Want? Working with OAuth in SharePoint 2013.
 
Asp.net.
Asp.net.Asp.net.
Asp.net.
 
Working With Sharepoint 2013 Apps Development
Working With Sharepoint 2013 Apps DevelopmentWorking With Sharepoint 2013 Apps Development
Working With Sharepoint 2013 Apps Development
 
CSOM (Client Side Object Model). Explained @ SharePoint Saturday Houston
CSOM (Client Side Object Model). Explained @ SharePoint Saturday HoustonCSOM (Client Side Object Model). Explained @ SharePoint Saturday Houston
CSOM (Client Side Object Model). Explained @ SharePoint Saturday Houston
 
Server Controls of ASP.Net
Server Controls of ASP.NetServer Controls of ASP.Net
Server Controls of ASP.Net
 
Asp.net server controls
Asp.net server controlsAsp.net server controls
Asp.net server controls
 
ASP.NET - Web Programming
ASP.NET - Web ProgrammingASP.NET - Web Programming
ASP.NET - Web Programming
 
Toms introtospring mvc
Toms introtospring mvcToms introtospring mvc
Toms introtospring mvc
 
Introduction to using jQuery with SharePoint
Introduction to using jQuery with SharePointIntroduction to using jQuery with SharePoint
Introduction to using jQuery with SharePoint
 

Destaque

Senior Internship Paper
Senior Internship PaperSenior Internship Paper
Senior Internship Paper
Brittany Lund
 
Jim Nicholls CV 22 Oct 2015
Jim Nicholls CV 22 Oct 2015Jim Nicholls CV 22 Oct 2015
Jim Nicholls CV 22 Oct 2015
Jim Nicholls
 
ΠΛΗ31 ΚΑΡΤΕΣ ΜΑΘΗΜΑΤΟΣ 3.5 (ΕΚΤΥΠΩΣΗ)
ΠΛΗ31 ΚΑΡΤΕΣ ΜΑΘΗΜΑΤΟΣ 3.5 (ΕΚΤΥΠΩΣΗ)ΠΛΗ31 ΚΑΡΤΕΣ ΜΑΘΗΜΑΤΟΣ 3.5 (ΕΚΤΥΠΩΣΗ)
ΠΛΗ31 ΚΑΡΤΕΣ ΜΑΘΗΜΑΤΟΣ 3.5 (ΕΚΤΥΠΩΣΗ)
Dimitris Psounis
 
ΠΛΗ31 ΚΑΡΤΕΣ ΜΑΘΗΜΑΤΟΣ 3.4 (ΕΚΤΥΠΩΣΗ)
ΠΛΗ31 ΚΑΡΤΕΣ ΜΑΘΗΜΑΤΟΣ 3.4 (ΕΚΤΥΠΩΣΗ)ΠΛΗ31 ΚΑΡΤΕΣ ΜΑΘΗΜΑΤΟΣ 3.4 (ΕΚΤΥΠΩΣΗ)
ΠΛΗ31 ΚΑΡΤΕΣ ΜΑΘΗΜΑΤΟΣ 3.4 (ΕΚΤΥΠΩΣΗ)
Dimitris Psounis
 

Destaque (19)

Protección jurídica del software
Protección jurídica del softwareProtección jurídica del software
Protección jurídica del software
 
Valentine's Day Back to Back
Valentine's Day Back to BackValentine's Day Back to Back
Valentine's Day Back to Back
 
Dokumentacija-Ana
Dokumentacija-AnaDokumentacija-Ana
Dokumentacija-Ana
 
Tilastollisen vaihtelun ilmentäminen
Tilastollisen vaihtelun ilmentäminenTilastollisen vaihtelun ilmentäminen
Tilastollisen vaihtelun ilmentäminen
 
Senior Internship Paper
Senior Internship PaperSenior Internship Paper
Senior Internship Paper
 
Gyostage 15.10.2016
Gyostage 15.10.2016Gyostage 15.10.2016
Gyostage 15.10.2016
 
Jim Nicholls CV 22 Oct 2015
Jim Nicholls CV 22 Oct 2015Jim Nicholls CV 22 Oct 2015
Jim Nicholls CV 22 Oct 2015
 
Deployment no Azure
Deployment no AzureDeployment no Azure
Deployment no Azure
 
TVT-strategiat - Vaasan kaupungin sivistystoimi
TVT-strategiat - Vaasan kaupungin sivistystoimiTVT-strategiat - Vaasan kaupungin sivistystoimi
TVT-strategiat - Vaasan kaupungin sivistystoimi
 
Digiloikasta pedaloikkaan
Digiloikasta pedaloikkaanDigiloikasta pedaloikkaan
Digiloikasta pedaloikkaan
 
Koodikerho PEPE Pajapäivä 6.9.2016
Koodikerho PEPE Pajapäivä 6.9.2016Koodikerho PEPE Pajapäivä 6.9.2016
Koodikerho PEPE Pajapäivä 6.9.2016
 
Treaty of paris
Treaty of parisTreaty of paris
Treaty of paris
 
fazaia inter college lahore 9th class papers examination
fazaia inter college lahore 9th class papers examinationfazaia inter college lahore 9th class papers examination
fazaia inter college lahore 9th class papers examination
 
Biogeochemical cycle
Biogeochemical cycleBiogeochemical cycle
Biogeochemical cycle
 
Final examination 2011 class vi
Final examination 2011 class viFinal examination 2011 class vi
Final examination 2011 class vi
 
Mid term examination -2011 class vi
Mid term examination -2011 class viMid term examination -2011 class vi
Mid term examination -2011 class vi
 
ΠΛΗ31 ΚΑΡΤΕΣ ΜΑΘΗΜΑΤΟΣ 3.5 (ΕΚΤΥΠΩΣΗ)
ΠΛΗ31 ΚΑΡΤΕΣ ΜΑΘΗΜΑΤΟΣ 3.5 (ΕΚΤΥΠΩΣΗ)ΠΛΗ31 ΚΑΡΤΕΣ ΜΑΘΗΜΑΤΟΣ 3.5 (ΕΚΤΥΠΩΣΗ)
ΠΛΗ31 ΚΑΡΤΕΣ ΜΑΘΗΜΑΤΟΣ 3.5 (ΕΚΤΥΠΩΣΗ)
 
ΠΛΗ31 ΚΑΡΤΕΣ ΜΑΘΗΜΑΤΟΣ 3.4 (ΕΚΤΥΠΩΣΗ)
ΠΛΗ31 ΚΑΡΤΕΣ ΜΑΘΗΜΑΤΟΣ 3.4 (ΕΚΤΥΠΩΣΗ)ΠΛΗ31 ΚΑΡΤΕΣ ΜΑΘΗΜΑΤΟΣ 3.4 (ΕΚΤΥΠΩΣΗ)
ΠΛΗ31 ΚΑΡΤΕΣ ΜΑΘΗΜΑΤΟΣ 3.4 (ΕΚΤΥΠΩΣΗ)
 
Web Design Trends: Ins & Outs
Web Design Trends: Ins & OutsWeb Design Trends: Ins & Outs
Web Design Trends: Ins & Outs
 

Semelhante a SharePoint 2010 Client-side Object Model

SharePoint Silverlight Sandboxed solutions
SharePoint Silverlight Sandboxed solutionsSharePoint Silverlight Sandboxed solutions
SharePoint Silverlight Sandboxed solutions
Phil Wicklund
 
Custom SharePoint 2010 solutions without server access
Custom SharePoint 2010 solutions without server accessCustom SharePoint 2010 solutions without server access
Custom SharePoint 2010 solutions without server access
Phil Wicklund
 
Session 5-SharePoint with Office-Donovan Follette
Session 5-SharePoint with Office-Donovan FolletteSession 5-SharePoint with Office-Donovan Follette
Session 5-SharePoint with Office-Donovan Follette
Mithun T. Dhar
 
SharePoint 2010 Application Development
SharePoint 2010 Application DevelopmentSharePoint 2010 Application Development
SharePoint 2010 Application Development
mattbremer
 
Wss Object Model
Wss Object ModelWss Object Model
Wss Object Model
maddinapudi
 
Chris McNulty: ECM/WCM Planning, Implementation and Migration Strategies
Chris McNulty: ECM/WCM Planning, Implementation and Migration StrategiesChris McNulty: ECM/WCM Planning, Implementation and Migration Strategies
Chris McNulty: ECM/WCM Planning, Implementation and Migration Strategies
SharePoint Saturday NY
 
Solve Todays Problems with 10 New SharePoint 2010 Features
Solve Todays Problems with 10 New SharePoint 2010 FeaturesSolve Todays Problems with 10 New SharePoint 2010 Features
Solve Todays Problems with 10 New SharePoint 2010 Features
Cory Peters
 
Parallelminds.asp.net web service
Parallelminds.asp.net web serviceParallelminds.asp.net web service
Parallelminds.asp.net web service
parallelminder
 
SharePoint 2010 and its development tools
SharePoint 2010 and its development toolsSharePoint 2010 and its development tools
SharePoint 2010 and its development tools
Shakir Majeed Khan
 

Semelhante a SharePoint 2010 Client-side Object Model (20)

SharePoint Silverlight Sandboxed solutions
SharePoint Silverlight Sandboxed solutionsSharePoint Silverlight Sandboxed solutions
SharePoint Silverlight Sandboxed solutions
 
Custom SharePoint 2010 solutions without server access
Custom SharePoint 2010 solutions without server accessCustom SharePoint 2010 solutions without server access
Custom SharePoint 2010 solutions without server access
 
Session 5-SharePoint with Office-Donovan Follette
Session 5-SharePoint with Office-Donovan FolletteSession 5-SharePoint with Office-Donovan Follette
Session 5-SharePoint with Office-Donovan Follette
 
SharePoint 2010 Developer 101
SharePoint 2010 Developer 101SharePoint 2010 Developer 101
SharePoint 2010 Developer 101
 
SharePoint 2010 Application Development
SharePoint 2010 Application DevelopmentSharePoint 2010 Application Development
SharePoint 2010 Application Development
 
SharePoint 2010 as a Development Platform, Ayman El-Hattab MVP
SharePoint 2010 as a Development Platform, Ayman El-Hattab MVPSharePoint 2010 as a Development Platform, Ayman El-Hattab MVP
SharePoint 2010 as a Development Platform, Ayman El-Hattab MVP
 
Office 365 development
Office 365 developmentOffice 365 development
Office 365 development
 
Wss Object Model
Wss Object ModelWss Object Model
Wss Object Model
 
Chris McNulty: ECM/WCM Planning, Implementation and Migration Strategies
Chris McNulty: ECM/WCM Planning, Implementation and Migration StrategiesChris McNulty: ECM/WCM Planning, Implementation and Migration Strategies
Chris McNulty: ECM/WCM Planning, Implementation and Migration Strategies
 
Solve Todays Problems with 10 New SharePoint 2010 Features
Solve Todays Problems with 10 New SharePoint 2010 FeaturesSolve Todays Problems with 10 New SharePoint 2010 Features
Solve Todays Problems with 10 New SharePoint 2010 Features
 
Intro to SharePoint for Developers
Intro to SharePoint for DevelopersIntro to SharePoint for Developers
Intro to SharePoint for Developers
 
SharePoint Developer Education Day Palo Alto
SharePoint  Developer Education Day  Palo  AltoSharePoint  Developer Education Day  Palo  Alto
SharePoint Developer Education Day Palo Alto
 
Share Point For Beginners V1
Share Point For Beginners V1Share Point For Beginners V1
Share Point For Beginners V1
 
Parallelminds.asp.net web service
Parallelminds.asp.net web serviceParallelminds.asp.net web service
Parallelminds.asp.net web service
 
The SharePoint & jQuery Guide
The SharePoint & jQuery GuideThe SharePoint & jQuery Guide
The SharePoint & jQuery Guide
 
The SharePoint and jQuery Guide by Mark Rackley - SPTechCon
The SharePoint and jQuery Guide by Mark Rackley - SPTechConThe SharePoint and jQuery Guide by Mark Rackley - SPTechCon
The SharePoint and jQuery Guide by Mark Rackley - SPTechCon
 
SharePoint 2010 and its development tools
SharePoint 2010 and its development toolsSharePoint 2010 and its development tools
SharePoint 2010 and its development tools
 
SharePoint Saturday Los Angeles 2011 SharePoint 2010 as The Business Intellig...
SharePoint Saturday Los Angeles 2011 SharePoint 2010 as The Business Intellig...SharePoint Saturday Los Angeles 2011 SharePoint 2010 as The Business Intellig...
SharePoint Saturday Los Angeles 2011 SharePoint 2010 as The Business Intellig...
 
SharePoint Branding Guidance @ SharePoint Saturday Redmond
SharePoint Branding Guidance @ SharePoint Saturday RedmondSharePoint Branding Guidance @ SharePoint Saturday Redmond
SharePoint Branding Guidance @ SharePoint Saturday Redmond
 
KMA Deck -C. McNulty discusses ecm wcm-upgrades2010 - nyc
KMA Deck -C. McNulty discusses ecm wcm-upgrades2010 - nycKMA Deck -C. McNulty discusses ecm wcm-upgrades2010 - nyc
KMA Deck -C. McNulty discusses ecm wcm-upgrades2010 - nyc
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

SharePoint 2010 Client-side Object Model

  • 1. SHAREPOINT 2010 CLIENT SIDE OBJECT MODEL Phil Wicklund SharePoint FREEWARE www.PhilWicklund.com SharePoint CONSULTING www.RBAconsulting.com
  • 2. About Me? Training & Certifications: • MCTIP: SharePoint 2010 Administration • MCPD: SharePoint 2010 Development • Microsoft’s SharePoint Masters Training (Redmond, WA) Other Notable Experience: • Published Author on SharePoint 2010 (SharePoint 2010 Workflows in Action) • National Speaker at SharePoint Conferences (The Experts Conference-LA, SharePoint Technology Conference-San Fran, TechFuse-MN, SharePoint Saturdays) • SharePoint Blog: www.philwicklund.com About Me: Over 6 years of experience SharePoint Architecture Experience, trained SharePoint architecture and development classes for nationally renown SharePoint- focused training organization.
  • 3. Agenda  Introduction / Why COM?  COM Architecture  Coding Samples  DEMO  .NET COM  Questions SharePoint FREEWARE www.PhilWicklund.com SharePoint CONSULTING www.RBAconsulting.com
  • 4. 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
  • 6. 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
  • 7. Comparable Objects Microsoft.SharePoint Client Object Models SPContext ClientContext SPSite Site SPWeb Web SPList List SPListItem ListItem SPField Field SPFile File SharePoint FREEWARE www.PhilWicklund.com SharePoint CONSULTING www.RBAconsulting.com
  • 8. 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
  • 9. 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
  • 10. 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
  • 11. 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
  • 12. 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
  • 13. Adding new List Items List list = context.Web.Lists. GetByTitle(“List Title"); context.Load(list); ListItem newItem = list.AddItem(new ListItemCreationInformation()); newItem["Title"] = "My new item"; newItem.Update(); context.ExecuteQuery(); SharePoint FREEWARE www.PhilWicklund.com SharePoint CONSULTING www.RBAconsulting.com
  • 14. 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, ClientRequestSucceededEventArgs args) { RunQuery runQuery= Run; this.Dispatcher.BeginInvoke(runQuery); } private delegate void RunQuery(); private void Run() { /* do something */ } private void failure(object sender, ClientRequestFailedEventArgs args) { /* do something */ } SharePoint FREEWARE www.PhilWicklund.com SharePoint CONSULTING www.RBAconsulting.com
  • 15. .NET – COM Demo  Build a Console (client) Application  Render all the List Titles from a remote SharePoint site.  Create a new list item in a remote SharePoint site. SharePoint FREEWARE www.PhilWicklund.com SharePoint CONSULTING www.RBAconsulting.com
  • 16. QUESTIONS & COMMENTS Phil Wicklund SharePoint FREEWARE www.PhilWicklund.com SharePoint CONSULTING www.RBAConsulting.com