Powering up your Office 365 cmdlets with CSOM Bjoern H Rapp, Senior Architect Public Cloud, SopraSteria.

Slides:



Advertisements
Similar presentations
SharePoint 2010 Client Side Object Model. Agenda Introduction The Problem Client side vs Server Side Client Side Object Model – How it works – What can.
Advertisements

Microsoft ® Official Course Client-Side SharePoint Development SharePoint Practice Microsoft SharePoint 2013.
Painless PowerShell for SharePoint Admins Rick Taylor.
Microsoft SharePoint® Online: Extensibility and Customization
02 | Managing Users, Groups, and Licenses Anthony Steven | Principal Technologist, Content Master Martin Coetzer | Portfolio Architect, Microsoft.
Non-displaying slide…. SharePoint 2010 and 2013 Auditing and Site Content Administration using PowerShell 55095AC.
Visual Studio 2010 SharePoint Developer Tools. Developer Tools for SharePoint  Familiar VS Experience  Build, Debug, Deploy SharePoint projects  Visual.
Microsoft SharePoint 2013 SharePoint 2013 as a Developer Platform
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Microsoft ® Official Course Introducing Apps for SharePoint SharePoint Practice Microsoft SharePoint 2013.
Becky Bertram SharePoint MVP
Intro to Apps Minnesota SharePoint User Group Raymond April 2014.
Sharepoint Portal Server Basics. Introduction Sharepoint server belongs to Microsoft family of servers Integrated suite of server capabilities Hosted.
©2011 Quest Software, Inc. All rights reserved. Steve Walch, Senior Product Manager Blog: November, 2011 Partner Training Webcast.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Facebook Like Solution in SharePoint Using JavaScript Amie Seisay
Excellence in Software Engineering Client-Side Object Model MS SharePoint CSOM Belarus SharePoint User Group © 2012, by Ivan Padabed.
About Me I have been working with sharepoint since 2008 My blog:
Section 6: Using Windows PowerShell to Manage Group Policy Introducing Windows PowerShell Windows PowerShell Library for Group Policy Windows PowerShell-Based.
Online Conference June 17 th and 18 th SharePoint Online Administration with PowerShell.
SharePoint Online – Developing Solutions for the Cloud Chris Mayo Microsoft Corporation
What's New in Kinetic Calendar 2.0 Jack Boespflug Kinetic Data.
What’s New in SharePoint 2010 SharePoint 2010 Development Primer New Developer Tools for SharePoint 2010 SharePoint 2010 Integration with PowerShell.
How to create a SharePoint site MICROSOFT OFFICE SHAREPOINT DESIGNER.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Farm Site List Data External Lists ClientOM Client OM REST APIs.
Welcome to the Minnesota SharePoint User Group February 13 th, 2013 SharePoint 2013 – Developers Track - Client Side Rendering.
SharePoint Online Migration API and Improvements
UNDERSTANDING YOUR OPTIONS FOR CLIENT-SIDE DEVELOPMENT IN OFFICE 365 Mark Rackley
Automating SharePoint 2010 administration tasks with Power Shell Toni Frankola SharePoint MVP, Croatia
Office 365: SharePoint Online 31 May | SharePoint Saturday Calgary – 31 MAY 2014 About Me – Jason Kaczor
Workflow in Microsoft Office SharePoint Server Jessica Gruber Consultant Microsoft Corporation.
Introduction to the Power BI Platform Presented by Ted Pattison.
Office 365: Attack of the Clones! Building reusable site templates with the Office 365 PnP Framework.
Software services delivering SharePoint, Mobile, and Business Intelligence solutions Understanding and implementing the remote provision pattern in SharePoint.
Ontolica Fusion 4.0 The easy Automation Tool for SharePoint Steen Jakobsen Fusion Principal Architect
Esri UC 2014 | Technical Workshop | Administering ArcGIS for Server with Python Jon Bodamer.
Course Agenda Deep Dive into the Building Blocks and Services of the SharePoint Platform Module 1: Developing Advanced Workflow Scenarios in Office 365.
A Developer’s Introduction to SharePoint 2013 Apps Ryan McIntyre, MCITP, MCPD National
Productivity Architect Meet Chris Bortlik Author, Blogger, Speaker.
SharePoint Online and PowerShell?
Start-SPPowerShell – Introduction to PowerShell for SharePoint Admins and Developers Paul BAker.
ASP.NET Programming with C# and SQL Server First Edition
SharePoint Provisioning Success with PnP PowerShell
Effective Client-side Coding against Office 365
Automate Custom Solutions Deployment on Office 365 and Azure
To the Command Line and Beyond Jeremy Sublett Composable Systems, LLC
Building Dynamic Applications with the SharePoint Client Object Model
Line of Business Solutions in SharePoint Online
Who Needs a Developer for Automated SharePoint Provisioning?
SharePoint Site Admin Training
SharePoint Framework Extensions
Migration to SharePoint 2013
Application Lifecycle Management – Best Practices for SharePoint and Office App development November 2015.
Module 1: Getting Started
SharePoint Saturday Omaha April 2016
Office 365 PowerShell Jeremy Sublett.
Hybrid Search Technical Guidance.
Office 365 Development July 2014.
Introduction to SharePoint Framework (SPFx)
Introduction to SharePoint Framework
Site scripts and Site Design
Visual Studio 2010 SharePoint Development Tools Overview
PowerShell and Office 365 IT Pro #AwesomeSauce
PowerShell + SharePoint Online – An Admins Guide to Administration in the O365 Cloud Marrell Sanders – Sr. SharePoint Administrator NACS Branson, MO.
PowerShell + SharePoint Online – An Admins Guide to Administration in the O365 Cloud Marrell Sanders – Sr. SharePoint Administrator SharePoint Saturday.
08 | Configuring SharePoint Online
MS Confidential : SharePoint 2010 Developer Workshop (Beta1)
10/2/ :13 PM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
Presentation transcript:

Powering up your Office 365 cmdlets with CSOM Bjoern H Rapp, Senior Architect Public Cloud, SopraSteria

@bjoern_rappwww.sharepointviking.com

Introduction CSOM and Powershell Office Dev PnP Cmdlets AGENDA

4

The Office 365 PowerShell Landscape

SharePoint Online PowerShell Module  Format: Noun-part starts with «SPO» (Add-SPOUser, Get-SPOSite)  Requires Global Admin privileges  Management of users, sites and organizations   41 cmdlets 6

Site Groups Create a Site Group Remove a Site Group Set a Site Group Users Add a User to a group Get a User Set a User Remove a User from a group Sites Create a SC Delete a SC Repair a SC Remove a SC Restore a deleted SC Add-Ins Get Add-In Errors Get Add-In Information Misc. Connect and disconnect Migration Jobs Set sync client properties

Example 1: Connect to SP Online Service

Import-Module Microsoft.Online.Sharepoint.PowerShell $credential = get-credential Connect-SPOService -url - Credential $credential #Create site collection New-SPOSite –Url -Owner –StorageQuota 1024 –Title «Site Name» –CompatibilityLevel 15 –LocaleID 1033 –ResourceQuota 300 –Template «STS#0» - Example 2: Create a Site Collection

Import-Module Microsoft.Online.Sharepoint.PowerShell $credential = get-credential Connect-SPOService -url - Credential $credential #Delete site collection Remove-SPOSite –Identity admin.sharepoint.com/SiteColName - NoWaithttps://contoso- admin.sharepoint.com/SiteColName Example 3: Remove a Site Collection

Import-Module Microsoft.Online.Sharepoint.PowerShell $credential = get-credential Connect-SPOService -url - Credential $credential #Import content from csv and create a site collection per row Import-Csv.\NewSPOSites.csv | % {New-SPOSite –Owner $_.Owner – StorageQuota $_.StorageQuota –Url $_.Url -NoWait –ResourceQuota $_.ResourceQuota –Template $_.Template –Title $_.Name Example 4: Create multiple sites by importing from.csv file

Other samples at: samples/

DEMO Using SharePoint Online Management PowerShell

15

Client-Side Object Model An API for running SharePoint code against the object model directly from a client Commands are packed as xml’s and sent in batches to SharePoint What is CSOM? JavaScript LogicManaged Logic Client.svc JSOM Managed OM Proxy Server OM DB XML Request JSON Response

SPO PowerShell too limited for Site Collection- level operations and below (700+ cmdlets in SP On Prem PowerShell module vs 41 in SPO ) Need for tools to perform repetitive tasks on objects in SPO (Webs, Lists, Linraries, Items, Documents). Cannot use SPO PowerShell for scripting Managed Metadata, Search, User Profiles etc. Why using CSOM with PowerShell?

Scripts can be written with any editor, no need to recompile using Visual Studio Can use PowerShell ISE or PowerGUI for debugging Leverage PowerShell’s strength our CSOM scripts, like reading XML, using other modules Can only perform operations where the method exists Some unusual constructs (heavy use of new-object and [ ]:: notation to reference enums and static methods CSOM with PowerShell pro’s and con’s

Preparing your environment

Simple CSOM Managed Code // Starting with ClientContext, the constructor requires a URL to the // server running SharePoint. ClientContext context = new ClientContext(" // The SharePoint web at the URL. Web web = context.Web; // We want to retrieve the web's properties. context.Load(web); // Execute the query to the server. context.ExecuteQuery(); //Display web properties, such as title. label1.Text = web.Title

Simple CSOM using PowerShell Import-Module $site = ‘ $adm =‘ $pwd = Read-Host ‘Enter Password’ - AsSecureString #Credentials $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($adm,$pwd) #Starting with ClientContext, the constructor requires a URL to the // server running SharePoint. $context = New-Object Microsoft.SharePoint.Client.ClientContext(" $context.Credentials = $credentials #We want to retrieve the web's properties. $web = $context.web $context.Load($web) #Execute the query to the server. $context.ExecuteQuery(); #Display web properties, such as title. Write-Host $web.Title

Creating a list Import-Module $site = ‘ $adm =‘ $pwd = Read-Host ‘Enter Password’ –AsSecureString $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($adm,$pwd) $context = New-Object Microsoft.SharePoint.Client.ClientContext(" $context.Credentials = $credentials $web = $context.web $creationInfo = New-Object Microsoft.SharePoint.Client.ListCreationInformation $creationInfo.Title = "Announcements" $creationInfo.TemplateType = [int][Microsoft.SharePoint.Client.ListTemplateType]::Announcements $list = $web.Lists.Add($creationInfo) $list.Description = "An announcement list made with CSOM" $list.Update() $context.ExecuteQuery()

DEMO Using CSOM with PowerShell

24

Office365 Dev Patterns and Practices

Getting the tools   2 editions:  PnPPowerShellCommands15.msi (SP 2013 On-Premises)  PnPPowerShellCommands16.msi (SharePoint Online)  Run the installer, and click Finish.

SPO PowerShell works well as a supplement to the Administration Console for Global Admin tasks in SharePoint Online SPO PowerShell cmdlets too limited for scripting tasks like Taxonomy, User Profiles, site, list and library operations PowerShell + CSOM gives you all tools you need but require a certain level of programming knowledge OfficeDev-PnP PowerShell modules look promising, but still very new and buggy from time to time. Will probably mature into a good toolset for both devs and it-pros. Summary

Related Sessions