Managing (O365) with PowerShell + CSOM
Transcript of Managing (O365) with PowerShell + CSOM
![Page 1: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/1.jpg)
Managing (O365) with PowerShell + CSOM
![Page 2: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/2.jpg)
GO
LD
RA
FF
LE
SIL
VE
RPLATINUM
![Page 3: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/3.jpg)
HELLO!My name is
Amit VasuSr. SharePoint Consultant, MVPwww.amitvasu.com
Twitter: @amitvasu
![Page 4: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/4.jpg)
Session Objective
Understand how to automate different SharePoint Online (Office 365) tasks using PowerShell and CSOM
This session is for Developers
And IT Pro as well
……May be NOT
![Page 5: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/5.jpg)
History LessonAmit’s PowerShell + CSOM Journey
![Page 6: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/6.jpg)
“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
![Page 7: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/7.jpg)
Typical CT deployment process
![Page 8: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/8.jpg)
How do we overcome - On Premises
![Page 9: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/9.jpg)
What are the challenges with O365
Guidance to not use declarative code for CT
You cannot use custom code in Sandbox solution.
Farm solutions are out of question.
![Page 10: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/10.jpg)
Remote Provisioning to Rescue
![Page 11: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/11.jpg)
Remote Provisioning
Write C# CSOM/REST Provider hosted App
JSOM
PowerShell + CSOM
![Page 12: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/12.jpg)
SharePoint Farm1
Provider Hosted
Apps
Own app specific
configuration
Artefacts
24
CSOM / REST
3
Remote Provisioning Process – CSOM/REST
![Page 13: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/13.jpg)
CSOM – Power Talk
![Page 14: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/14.jpg)
Remote Provisioning
Client side library for remotely communicating with SharePoint
Introduced in SharePoint 2010
Expanded upon in SharePoint 2013
![Page 15: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/15.jpg)
CSOM in SharePoint 2010
![Page 16: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/16.jpg)
CSOM in SharePoint 2013
![Page 17: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/17.jpg)
How CSOM Works
![Page 18: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/18.jpg)
CSOM – Code Example
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);
![Page 19: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/19.jpg)
How do I start
![Page 20: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/20.jpg)
Steps to start developing
Pick your Development environment
Local Machine
SharePoint 2013 Environment
![Page 21: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/21.jpg)
Local Machine
Required copy of all SharePoint Client DLL
Located at C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI
All DLLs that starts with Microsoft.SharePoint.Client
Reference them in your code from the location you copied them
![Page 22: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/22.jpg)
SharePoint Environment
No need to do anything other than referencing DLLs from ISAPI folder.
![Page 23: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/23.jpg)
Optional – Download CSOM Assemblies
![Page 24: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/24.jpg)
DEMOPowerShell + CSOM
![Page 25: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/25.jpg)
Summary
![Page 26: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/26.jpg)
Why PowerShell + CSOM
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-premises
Spend time understanding CSOM
Microsoft.SharePoint.Client namespace
![Page 27: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/27.jpg)
Resources
https://sharepointpowershell.codeplex.com/
https://sharepointonlineautomationcmdlets.codeplex.com/
http://social.technet.microsoft.com/wiki/contents/articles/29518.csom-sharepoint-powershell-reference-and-example-codes.aspx
![Page 28: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/28.jpg)
GO
LD
RA
FF
LE
SIL
VE
RPLATINUM
![Page 29: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/29.jpg)
Thank you!Toronto Enterprise Collaboration User GroupChange Management, Governance, SharePoint, Office 365, Yammer, PowerBI, etc
http://www.meetup.com/TSPBUG/Toronto SharePoint Business Users Grouphttp://www.meetup.com/TorontoSPUG/
Saturday July 9, 2016
See you next year!
![Page 31: Managing (O365) with PowerShell + CSOM](https://reader034.fdocuments.net/reader034/viewer/2022042511/5868e3151a28ab917d8b91d3/html5/thumbnails/31.jpg)
THANK YOU