extending powershell with the client side object model

Download Extending Powershell with the Client Side Object Model

If you can't read please download the document

Upload: adele-hall

Post on 17-Dec-2015

216 views

Category:

Documents


1 download

TRANSCRIPT

  • Slide 1
  • Extending Powershell with the Client Side Object Model
  • Slide 2
  • #SPRUNNERS @rbethleh About me [email protected]
  • Slide 3
  • 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 cmdlets SharePoint Onpremise has 730 cmdlets
  • Slide 4
  • Antipattern: Mechanical Turk Fail Often, Fail Fast, Fail Cheap To err is human
  • Slide 5
  • What about SharePoint Onpremise? Stuff that deploys on SharePoint Online should also deploy OnPremise Dev on premise, deploy to the cloud
  • Slide 6
  • 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
  • Slide 7
  • So what did I do? Started out with Powershell Powershell does not know about Generics ClientContext.Load( ); So: Roll your own cmdlet since.NET does not have this restriction
  • Slide 8
  • 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 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
  • Slide 9
  • Restrictions Search Schema such as Managed properties (although you can export config) Userprofile properties Audiences Trust apps Activate a sandbox solution Use DesignPackageInfo
  • Slide 10
  • Final thoughts sponlinecmdlets.codeplex.com spcb.codeplex.com
  • Slide 11
  • Links Cmdlets: http://msdn.microsoft.com/en- us/library/system.management.automation.cmdlet%28v=vs.85%29.aspx SharePoint Online and Onpremise cmdlets: http://blog.blksthl.com/2013/01/15/sharepoint-2013-powershell-cmdlets-listed-onprem-vs- online/ Service locator pattern in C#: http://stefanoricciardi.com/2009/09/25/service-locator-pattern-in-csharpa-simple-example/