spca2013 - extending powershell with the client side object model

Post on 09-May-2015

868 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

Extending Powershell with the Client Side Object Model

TRANSCRIPT

Extending Powershell with the Client Side Object Model

#SPRUNNERS

@rbethleh

About me

roelhans.bethlehem@rapidcircle.com

Developing for SharePoint Online

Microsoft only gave us SharePoint Online Admin Tenant CmdLets

How can we make development repeatable

How to get to Continuous Integration across Development, Test, Acceptance and Production

SharePoint Online has 27 cmdletsSharePoint Onpremise has 730 cmdlets

Roel Hans Bethlehem
What is a cmdlet

Antipattern: Mechanical Turk

Fail Often, Fail FastTo err is human

What about SharePoint Onpremise?

Cloud ReadyStuff that deploys on SharePoint Online should also deploy On Premises

Cloud ReadyDev on premise, deploy to the cloud

So what can you do?

Declarative: Onet.xml, webtemplates, modules wrapped in WSP

(Sandboxed) Event Receivers

Client Side Object Model (CSOM)

JavaScript Object Model

SharePoint Online Powershell CmdLets

Powershell + Client Side Object Model

So what did I do?

Started out with Powershell

Powershell does not know about Generics

ClientContext.Load(<type>);

So: Roll your own cmdlet since .NET does not have this restriction

Demo

Create taxonomy field in both Sharepoint Online and SharePoint onpremise

Extending with Powershell

● System.Management.Automation.PSCmdLet ● Decorate the class with attributes● Override ProcessRecord method● Use a Service Locator Pattern to dynamically load credential class● Upload and deploy Sandbox Solution automagically● Do some stuff to SharePoint Online / SharePoint OnPremise to finish taxonomy

field

Ingredients

● Sandbox solution defining contenttype● Loaded termset● Both a SharePoint OnPremise server and SharePoint Online tenant● Powershell cmdlet Set-TaxonomyFieldAssociation● SharePoint Client Browser

Restrictions

Search Schema such as Managed properties (although you can export config)

Userprofile properties

Audiences

Deploy/Trust apps: Check out app stapling - http://blogs.msdn.com/b/richard_dizeregas_blog/archive/2013/03/04/sharepoint-2013-app-deployment-through-quot-app-stapling-quot.aspx

Activate a sandbox solutionUse DesignPackageInfo – see codeplex (idea from http://blog.symprogress.com/2013/07/apply-designpackage-using-client-object-model/)

Final thoughts

sponlinecmdlets.codeplex.com

spcb.codeplex.com

top related