SlideShare a Scribd company logo
1 of 31
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
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
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
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
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!!!
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

What's hot

[Noel] Azure AD Connect Technical Deep Dive
[Noel] Azure AD Connect Technical Deep Dive[Noel] Azure AD Connect Technical Deep Dive
[Noel] Azure AD Connect Technical Deep Dive
European Collaboration Summit
 
SharePoint Intersections - SP11 - SharePoint and IaaS - The OnPrem in the Cloud
SharePoint Intersections - SP11 - SharePoint and IaaS - The OnPrem in the CloudSharePoint Intersections - SP11 - SharePoint and IaaS - The OnPrem in the Cloud
SharePoint Intersections - SP11 - SharePoint and IaaS - The OnPrem in the Cloud
Dan Usher
 
Windows Azure Active Directory
Windows Azure Active DirectoryWindows Azure Active Directory
Windows Azure Active Directory
Pavel Revenkov
 
SPTechCon - Boston 2014 - Getting started with Office 365
SPTechCon - Boston 2014 - Getting started with Office 365SPTechCon - Boston 2014 - Getting started with Office 365
SPTechCon - Boston 2014 - Getting started with Office 365
Dan Usher
 

What's hot (20)

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

Viewers also liked (7)

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

Similar to Spsdc 2014 o365_power_shell_csom_amitv

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
 

Similar to Spsdc 2014 o365_power_shell_csom_amitv (20)

Spsnyc 2014 o365 power shell csom
Spsnyc 2014   o365 power shell csomSpsnyc 2014   o365 power shell csom
Spsnyc 2014 o365 power shell csom
 
SPSToronto 2015 - Managing Office365 with PowerShell and CSOM
SPSToronto 2015 - Managing Office365 with PowerShell and CSOMSPSToronto 2015 - Managing Office365 with PowerShell and CSOM
SPSToronto 2015 - Managing Office365 with PowerShell and CSOM
 
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
 
Sps boston 2014_o365_power_shell_csom_amitv
Sps boston 2014_o365_power_shell_csom_amitvSps boston 2014_o365_power_shell_csom_amitv
Sps boston 2014_o365_power_shell_csom_amitv
 
Chris O'Brien - Modern SharePoint development: techniques for moving code off...
Chris O'Brien - Modern SharePoint development: techniques for moving code off...Chris O'Brien - Modern SharePoint development: techniques for moving code off...
Chris O'Brien - Modern SharePoint development: techniques for moving code off...
 
The SharePoint & jQuery Guide - Updated 1/14/14
The SharePoint & jQuery Guide - Updated 1/14/14The SharePoint & jQuery Guide - Updated 1/14/14
The SharePoint & jQuery Guide - Updated 1/14/14
 
Spsdc what's new in share point 2013 workflow
Spsdc   what's new in share point 2013 workflowSpsdc   what's new in share point 2013 workflow
Spsdc what's new in share point 2013 workflow
 
Introducción al SharePoint Framework SPFx
Introducción al SharePoint Framework SPFxIntroducción al SharePoint Framework SPFx
Introducción al SharePoint Framework SPFx
 
(Updated) SharePoint & jQuery Guide
(Updated) SharePoint & jQuery Guide(Updated) SharePoint & jQuery Guide
(Updated) SharePoint & jQuery Guide
 
Intro to SharePoint for Developers
Intro to SharePoint for DevelopersIntro to SharePoint for Developers
Intro to SharePoint for Developers
 
Office 365 for Developers
Office 365 for DevelopersOffice 365 for Developers
Office 365 for Developers
 
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
 
AzureFest
AzureFestAzureFest
AzureFest
 
Building high performance
Building high performanceBuilding high performance
Building high performance
 
Webinar: Microsoft SharePoint-The Ultimate Enterprise Collaboration Platform
Webinar: Microsoft SharePoint-The Ultimate Enterprise Collaboration PlatformWebinar: Microsoft SharePoint-The Ultimate Enterprise Collaboration Platform
Webinar: Microsoft SharePoint-The Ultimate Enterprise Collaboration Platform
 
PHP on Windows and on Azure
PHP on Windows and on AzurePHP on Windows and on Azure
PHP on Windows and on Azure
 
Open event presentation.3 2
Open event presentation.3 2Open event presentation.3 2
Open event presentation.3 2
 
Dive into Microsoft SharePoint Server 2016 Upgrade, Migration and beyond
Dive into Microsoft SharePoint Server 2016 Upgrade, Migration and beyondDive into Microsoft SharePoint Server 2016 Upgrade, Migration and beyond
Dive into Microsoft SharePoint Server 2016 Upgrade, Migration and beyond
 
Site Provisioning with Modern SharePoint Sites and SIte Assets - O365 Saturda...
Site Provisioning with Modern SharePoint Sites and SIte Assets - O365 Saturda...Site Provisioning with Modern SharePoint Sites and SIte Assets - O365 Saturda...
Site Provisioning with Modern SharePoint Sites and SIte Assets - O365 Saturda...
 
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
 

More from amitvasu (8)

Introducing-Loop.pdf
Introducing-Loop.pdfIntroducing-Loop.pdf
Introducing-Loop.pdf
 
Updating your classic team site to use new office 365 features amit vasu
Updating your classic team site to use new office 365 features   amit vasuUpdating your classic team site to use new office 365 features   amit vasu
Updating your classic team site to use new office 365 features amit vasu
 
Introduction to azure functions
Introduction to azure functionsIntroduction to azure functions
Introduction to azure functions
 
Sps albany 2014_workflows_amit_vasu
Sps albany 2014_workflows_amit_vasuSps albany 2014_workflows_amit_vasu
Sps albany 2014_workflows_amit_vasu
 
Spsdc using sp2013 to crawl sp2010 farm
Spsdc using sp2013 to crawl sp2010 farmSpsdc using sp2013 to crawl sp2010 farm
Spsdc using sp2013 to crawl sp2010 farm
 
Sps ottawa 2013_workflows_amit_vasu
Sps ottawa 2013_workflows_amit_vasuSps ottawa 2013_workflows_amit_vasu
Sps ottawa 2013_workflows_amit_vasu
 
Spsto 2013 whats_newinworkflows_amitvasu.
Spsto 2013 whats_newinworkflows_amitvasu.Spsto 2013 whats_newinworkflows_amitvasu.
Spsto 2013 whats_newinworkflows_amitvasu.
 
Using workflows in share point 2010
Using workflows in share point 2010Using workflows in share point 2010
Using workflows in share point 2010
 

Recently uploaded

Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
FIDO Alliance
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 

Recently uploaded (20)

Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 

Spsdc 2014 o365_power_shell_csom_amitv

  • 1.
  • 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
  • 10.
  • 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
  • 15.
  • 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
  • 23.
  • 24.
  • 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
  • 26.
  • 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!!!
  • 29.
  • 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!