SlideShare a Scribd company logo
Spsdc 2014 o365_power_shell_csom_amitv
Thanks to our Sponsors!!!
http://www.sharepointnutsandbolts.com/
Chis O’Brien - MVP
Reference:
http://www.sharepointnutsandbolts.com/2013/12/Usin
g-CSOM-in-PowerShell-scripts-with-Office365.html
Credit for this session
Self Promotion 
Microsoft Community
Contributor (MCC)
Senior
SharePoint
Consultant
@amitvasuMCP – SP 2013
BLOG – www.amitvasu.com/blog
SharePoint Saturday DC
Agenda
PowerShell + CSOM
Background and CSOM Overview
How to Start DEMO
Final Thoughts
Why PowerShell + CSOM
Q/A
SharePoint Saturday DC
“FTC to CAM – Stop creating content types and site columns
declaratively”
http://blogs.msdn.com/b/vesku/archive/2013/11/06/ftc-to-cam-stop-creating-content-types-
and-site-columns-declaratively.aspx
How I started PowerShell + CSOM
SharePoint Saturday DC
Typical CT deployment process
SharePoint Saturday DC
What is being recommended
SharePoint Saturday DC
Challenge with O365
 Guidance to not use declarative code for CT
 You cannot use custom code in Sandbox
solution.
 Farm solutions are out of question.
SharePoint Saturday DC
Spsdc 2014 o365_power_shell_csom_amitv
CSOM Overview
 Client side library for remotely communicating
with SharePoint
 Introduced in SharePoint 2010
 Expanded upon in SharePoint 2013
SharePoint Saturday DC
CSOM Overview
How CSOM Works
SharePoint Saturday DC
CSOM Overview
 How CSOM works in SharePoint 2013
SharePoint Saturday DC
How CSOM Works
 Create Context
ClientContext ctx = new
ClientContext("http://intranet.contoso.com");
 Call Load and ExecuteQuery Before Accessing
Value Properties
Web web = ctx.Web;
ctx.Load(web);
ctx.ExecuteQuery();
Console.WriteLine(web.Title);
SharePoint Saturday DC
Spsdc 2014 o365_power_shell_csom_amitv
Steps to start developing
 Pick your Development environment
 Local Machine
 SharePoint 2013 Environment
SharePoint Saturday DC
Local Machine
 Required copy of all SharePoint Client DLL
 Located at C:Program FilesCommon Filesmicrosoft
sharedWeb Server Extensions15ISAPI
 All DLLs that starts with Microsoft.SharePoint.Client
 Reference them in your code from the location
you copied them
SharePoint Saturday DC
SharePoint Environment
 No need to do anything other than referencing
DLLs from ISAPI folder.
SharePoint Saturday DC
Optional – Download SPO DLLs
 Rene Modery - Script to download the
SharePoint Online DLLs
http://modery.net/script-to-download-the-sharepoint-online-
dlls/?utm_source=rss&utm_medium=rss&utm_campaign=script-to-download-
the-sharepoint-online-dlls
SharePoint Saturday DC
Add reference to your DLLs
$filePath = "c:Program FilesCommon Filesmicrosoft
sharedWeb Server Extensions15ISAPI"
Set-Location $filePath
Add-Type -Path (Resolve-Path
"Microsoft.SharePoint.Client.dll")
Add-Type -Path (Resolve-Path
"Microsoft.SharePoint.Client.Runtime.dll")
SharePoint Saturday DC
Authentication - SPO
$userName = "SomeUser@SomeOrg.onmicrosoft.com"
$siteUrl = "https://SomeSite.sharepoint.com"
$pwd = Read-Host -AsSecureString
$ctx = New-Object
Microsoft.SharePoint.Client.ClientContext($siteUrl)
$ctx.Credentials = New-Object
Microsoft.SharePoint.Client.SharePointOnlineCredenti
als($userName, $pwd)
SharePoint Saturday DC
Authentication – On-Prem
$userName = "SomeUser@SomeOrg.onmicrosoft.com"
$siteUrl = "https://SomeSite.sharepoint.com"
$pwd = Read-Host -AsSecureString
$ctx = New-Object
Microsoft.SharePoint.Client.ClientContext($siteUrl)
$ctx.Credentials = New-Object
System.Net.NetworkCredential($userName, $pwd)
SharePoint Saturday DC
Spsdc 2014 o365_power_shell_csom_amitv
Spsdc 2014 o365_power_shell_csom_amitv
Advantages
 Repeatable and automated
 Same script can be used across different
environments
 Extending out of the box PowerShell
 Works with on-prem as well as SharePoint Online *
SharePoint Saturday DC
Spsdc 2014 o365_power_shell_csom_amitv
Summary
 Anything you can do with CSOM can be achieved
using PowerShell + CSOM
 Great way to extend PowerShell capabilities
 Can be used with SharePoint Online and On-prem
 Spend time understanding CSOM
 Microsoft.SharePoint.Client namespace
SharePoint Saturday DC
Thanks to our Sponsors!!!
Spsdc 2014 o365_power_shell_csom_amitv
Join us at #SharePint sponsored by Metalogix at Clyde’s
of Chevy Chase in the RaceCar Bar Downstairs
Why? To network with fellow SharePoint professionals
What? SharePint!!!
When? 5:30 PM
Where?
RaceCar Bar Downstairs
5441 Wisconsin Ave
Chevy Chase, MD 20815
Thanks to?
Metalogix!
Spsdc 2014 o365_power_shell_csom_amitv

More Related Content

PDF
Spsct15 power shell_csom - amit vasu
PDF
Office 365 Directory Synchronization
PDF
Spsnyc15 azure and sp2013 amit_v
PDF
Office 365 directory synchronization - SPSDC Reston
PPTX
Tspug 2015 dirsync_amit_v_momentum
PPTX
[Wilen] Enriching conversations with your data in Microsoft Teams
PDF
O365Con18 - Azure AD Connect Inside and Out - Sander Berkouwer
PDF
O365Con18 - Hybrid SharePoint Deep Dive - Thomas Vochten
Spsct15 power shell_csom - amit vasu
Office 365 Directory Synchronization
Spsnyc15 azure and sp2013 amit_v
Office 365 directory synchronization - SPSDC Reston
Tspug 2015 dirsync_amit_v_momentum
[Wilen] Enriching conversations with your data in Microsoft Teams
O365Con18 - Azure AD Connect Inside and Out - Sander Berkouwer
O365Con18 - Hybrid SharePoint Deep Dive - Thomas Vochten

What's hot (20)

PDF
O365Con18 - Reach for the Cloud Build Solutions with the Power of Microsoft G...
PPTX
[Noel] Azure AD Connect Technical Deep Dive
PDF
[Struyf] Automate Your Tasks With Azure Functions
PPTX
[Vončina] Configuring SharePoint 2016 for BI Scenarios
PDF
O365Con18 - External Collaboration with Azure B2B - Sjoukje Zaal
PDF
O365Con18 - PowerApps build custom forms for SharePoint with Azure Maps - Bra...
PDF
SPUnite17 Building Great Client Side Web Parts with SPFx
PPTX
SharePoint Intersections - SP11 - SharePoint and IaaS - The OnPrem in the Cloud
PPTX
APIs, APIs Everywhere!
PPTX
Implementing Azure Active Directory Connect and more
PPTX
Developing Sandbox Solutions
PPTX
Windows Azure Active Directory
PDF
SPTechCon - Boston 2014 - Getting started with Office 365
PPTX
[Roine] Serverless: Don't Take It Literally
PDF
O365Con18 - Connect SharePoint Framework Solutions to API's secured with Azur...
PPTX
Integrating your on-premises Active Directory with Azure and Office 365
PPTX
Azure Active Directory
PPTX
[Vochten/Harbar] SharePoint Server On Premises & Hybrid PowerClass
PPTX
ECS 19 Anil Erduran - simplifying microsoft architectures with aws services
PDF
O365Con18 - Innovate, Connecting Bleeding Edge Technologies - Sjoukje Zaal & ...
O365Con18 - Reach for the Cloud Build Solutions with the Power of Microsoft G...
[Noel] Azure AD Connect Technical Deep Dive
[Struyf] Automate Your Tasks With Azure Functions
[Vončina] Configuring SharePoint 2016 for BI Scenarios
O365Con18 - External Collaboration with Azure B2B - Sjoukje Zaal
O365Con18 - PowerApps build custom forms for SharePoint with Azure Maps - Bra...
SPUnite17 Building Great Client Side Web Parts with SPFx
SharePoint Intersections - SP11 - SharePoint and IaaS - The OnPrem in the Cloud
APIs, APIs Everywhere!
Implementing Azure Active Directory Connect and more
Developing Sandbox Solutions
Windows Azure Active Directory
SPTechCon - Boston 2014 - Getting started with Office 365
[Roine] Serverless: Don't Take It Literally
O365Con18 - Connect SharePoint Framework Solutions to API's secured with Azur...
Integrating your on-premises Active Directory with Azure and Office 365
Azure Active Directory
[Vochten/Harbar] SharePoint Server On Premises & Hybrid PowerClass
ECS 19 Anil Erduran - simplifying microsoft architectures with aws services
O365Con18 - Innovate, Connecting Bleeding Edge Technologies - Sjoukje Zaal & ...
Ad

Viewers also liked (7)

PDF
Letter of Recommendation Mike O'Donnell
PPTX
Estadisticas
PDF
Untitled Presentation
PDF
David's LOR
PDF
Pulsera Personal ASHUA, siempre seguro vayas donde vayas!!!
PPTX
使徒33
DOCX
Aula 1- O que e alienação? Prof. Noe Assunção
Letter of Recommendation Mike O'Donnell
Estadisticas
Untitled Presentation
David's LOR
Pulsera Personal ASHUA, siempre seguro vayas donde vayas!!!
使徒33
Aula 1- O que e alienação? Prof. Noe Assunção
Ad

Similar to Spsdc 2014 o365_power_shell_csom_amitv (20)

PDF
Spsnyc 2014 o365 power shell csom
PDF
SPSToronto 2015 - Managing Office365 with PowerShell and CSOM
PPTX
Office 365 & PowerShell - A match made in heaven
PPTX
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
PPTX
SPSSTL - PowerShell - Through the SharePoint Looking Glass
PDF
Sps boston 2014_o365_power_shell_csom_amitv
PPTX
PowerShell: Through the SharePoint Looking Glass
PPTX
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
PPTX
How to do everything with PowerShell
PPTX
Power Shell and Sharepoint 2013
PDF
Basic powershell scripts
PPTX
SPSTC - PowerShell - Through the SharePoint Looking Glass
PPTX
Webinar - Office 365 & PowerShell : A Match Made in Heaven
PPTX
Managing SharePoint Anywhere with Windows PowerShell
PPTX
Chris O'Brien - Modern SharePoint development: techniques for moving code off...
PPT
Sharepoint Online
PPTX
SP24 S055 SharePointToolbox by Rodrigo Pinto
PPTX
SharePoint Development For Asp Net Developers
PPTX
NZ Code Camp 2011 PowerShell + SharePoint
PPTX
SharePoint Saturday Cincinnati 2014 - CSOM
Spsnyc 2014 o365 power shell csom
SPSToronto 2015 - Managing Office365 with PowerShell and CSOM
Office 365 & PowerShell - A match made in heaven
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
SPSSTL - PowerShell - Through the SharePoint Looking Glass
Sps boston 2014_o365_power_shell_csom_amitv
PowerShell: Through the SharePoint Looking Glass
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
How to do everything with PowerShell
Power Shell and Sharepoint 2013
Basic powershell scripts
SPSTC - PowerShell - Through the SharePoint Looking Glass
Webinar - Office 365 & PowerShell : A Match Made in Heaven
Managing SharePoint Anywhere with Windows PowerShell
Chris O'Brien - Modern SharePoint development: techniques for moving code off...
Sharepoint Online
SP24 S055 SharePointToolbox by Rodrigo Pinto
SharePoint Development For Asp Net Developers
NZ Code Camp 2011 PowerShell + SharePoint
SharePoint Saturday Cincinnati 2014 - CSOM

More from amitvasu (9)

PDF
Introducing-Loop.pdf
PDF
Updating your classic team site to use new office 365 features amit vasu
PDF
Introduction to azure functions
PDF
Spsdc what's new in share point 2013 workflow
PDF
Sps albany 2014_workflows_amit_vasu
PDF
Spsdc using sp2013 to crawl sp2010 farm
PDF
Sps ottawa 2013_workflows_amit_vasu
PDF
Spsto 2013 whats_newinworkflows_amitvasu.
PPTX
Using workflows in share point 2010
Introducing-Loop.pdf
Updating your classic team site to use new office 365 features amit vasu
Introduction to azure functions
Spsdc what's new in share point 2013 workflow
Sps albany 2014_workflows_amit_vasu
Spsdc using sp2013 to crawl sp2010 farm
Sps ottawa 2013_workflows_amit_vasu
Spsto 2013 whats_newinworkflows_amitvasu.
Using workflows in share point 2010

Recently uploaded (20)

PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
cuic standard and advanced reporting.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Electronic commerce courselecture one. Pdf
PPT
Teaching material agriculture food technology
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Programs and apps: productivity, graphics, security and other tools
cuic standard and advanced reporting.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
The AUB Centre for AI in Media Proposal.docx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Electronic commerce courselecture one. Pdf
Teaching material agriculture food technology
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Encapsulation theory and applications.pdf
Spectral efficient network and resource selection model in 5G networks
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Spectroscopy.pptx food analysis technology
Digital-Transformation-Roadmap-for-Companies.pptx
sap open course for s4hana steps from ECC to s4
Building Integrated photovoltaic BIPV_UPV.pdf
MYSQL Presentation for SQL database connectivity
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Unlocking AI with Model Context Protocol (MCP)

Spsdc 2014 o365_power_shell_csom_amitv

  • 2. Thanks to our Sponsors!!!
  • 3. http://www.sharepointnutsandbolts.com/ Chis O’Brien - MVP Reference: http://www.sharepointnutsandbolts.com/2013/12/Usin g-CSOM-in-PowerShell-scripts-with-Office365.html Credit for this session
  • 4. Self Promotion  Microsoft Community Contributor (MCC) Senior SharePoint Consultant @amitvasuMCP – SP 2013 BLOG – www.amitvasu.com/blog SharePoint Saturday DC
  • 5. Agenda PowerShell + CSOM Background and CSOM Overview How to Start DEMO Final Thoughts Why PowerShell + CSOM Q/A SharePoint Saturday DC
  • 6. “FTC to CAM – Stop creating content types and site columns declaratively” http://blogs.msdn.com/b/vesku/archive/2013/11/06/ftc-to-cam-stop-creating-content-types- and-site-columns-declaratively.aspx How I started PowerShell + CSOM SharePoint Saturday DC
  • 7. Typical CT deployment process SharePoint Saturday DC
  • 8. What is being recommended SharePoint Saturday DC
  • 9. Challenge with O365  Guidance to not use declarative code for CT  You cannot use custom code in Sandbox solution.  Farm solutions are out of question. SharePoint Saturday DC
  • 11. CSOM Overview  Client side library for remotely communicating with SharePoint  Introduced in SharePoint 2010  Expanded upon in SharePoint 2013 SharePoint Saturday DC CSOM Overview
  • 13. CSOM Overview  How CSOM works in SharePoint 2013 SharePoint Saturday DC
  • 14. How CSOM Works  Create Context ClientContext ctx = new ClientContext("http://intranet.contoso.com");  Call Load and ExecuteQuery Before Accessing Value Properties Web web = ctx.Web; ctx.Load(web); ctx.ExecuteQuery(); Console.WriteLine(web.Title); SharePoint Saturday DC
  • 16. Steps to start developing  Pick your Development environment  Local Machine  SharePoint 2013 Environment SharePoint Saturday DC
  • 17. Local Machine  Required copy of all SharePoint Client DLL  Located at C:Program FilesCommon Filesmicrosoft sharedWeb Server Extensions15ISAPI  All DLLs that starts with Microsoft.SharePoint.Client  Reference them in your code from the location you copied them SharePoint Saturday DC
  • 18. SharePoint Environment  No need to do anything other than referencing DLLs from ISAPI folder. SharePoint Saturday DC
  • 19. Optional – Download SPO DLLs  Rene Modery - Script to download the SharePoint Online DLLs http://modery.net/script-to-download-the-sharepoint-online- dlls/?utm_source=rss&utm_medium=rss&utm_campaign=script-to-download- the-sharepoint-online-dlls SharePoint Saturday DC
  • 20. Add reference to your DLLs $filePath = "c:Program FilesCommon Filesmicrosoft sharedWeb Server Extensions15ISAPI" Set-Location $filePath Add-Type -Path (Resolve-Path "Microsoft.SharePoint.Client.dll") Add-Type -Path (Resolve-Path "Microsoft.SharePoint.Client.Runtime.dll") SharePoint Saturday DC
  • 21. Authentication - SPO $userName = "SomeUser@SomeOrg.onmicrosoft.com" $siteUrl = "https://SomeSite.sharepoint.com" $pwd = Read-Host -AsSecureString $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl) $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredenti als($userName, $pwd) SharePoint Saturday DC
  • 22. Authentication – On-Prem $userName = "SomeUser@SomeOrg.onmicrosoft.com" $siteUrl = "https://SomeSite.sharepoint.com" $pwd = Read-Host -AsSecureString $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl) $ctx.Credentials = New-Object System.Net.NetworkCredential($userName, $pwd) SharePoint Saturday DC
  • 25. Advantages  Repeatable and automated  Same script can be used across different environments  Extending out of the box PowerShell  Works with on-prem as well as SharePoint Online * SharePoint Saturday DC
  • 27. Summary  Anything you can do with CSOM can be achieved using PowerShell + CSOM  Great way to extend PowerShell capabilities  Can be used with SharePoint Online and On-prem  Spend time understanding CSOM  Microsoft.SharePoint.Client namespace SharePoint Saturday DC
  • 28. Thanks to our Sponsors!!!
  • 30. Join us at #SharePint sponsored by Metalogix at Clyde’s of Chevy Chase in the RaceCar Bar Downstairs Why? To network with fellow SharePoint professionals What? SharePint!!! When? 5:30 PM Where? RaceCar Bar Downstairs 5441 Wisconsin Ave Chevy Chase, MD 20815 Thanks to? Metalogix!