Project Description
Use .NET code or PowerShell to automate SharePoint Online deployment tasks, such as authenticating without browser, and activate sandbox solutions.

Overview

This library's main purpose is to allow scripted deployment scenarios for SharePoint Online sandbox solutions.
Using C# or PowerShell 3.0, one may use this API to authenticate by supplying a login and password by code. Since the authentication is fully done by C# code, without using a web browser, it enables continued integration scenarios.
One can also use this Library to authenticate for using the SharePoint Client Object Model

Disclaimer

Since its purpose is to enable tasks that are voluntarily undoable in SharePoint Online, this Library does not use any official Microsoft API. Therefore, it's authentication capabilities and other features may break any day. For example, if the Microsoft Online login page changes, there are chances that this Library won't work anymore.
However, i will do my best to update the library as quick as possible if it happens.

API Description

Authentication API
  • CookieContainer Authenticator.Authenticate(siteCollectionUrl, login, password)
  • ClientContext Authenticator.GetClientContext(siteCollectionUrl, login, password)
  • ClientContext Authenticator.GetClientContext(siteCollectionUrl, cookies)

Sandbox Solutions management API
  • SandboxSolutions.UploadSolution(siteCollectionUrl, cookies, solutionName)
  • SandboxSolutions.ActivateSolution(siteCollectionUrl, cookies, solutionName)
  • SandboxSolutions.DeactivateSolution(siteCollectionUrl, cookies, solutionName)

Quick Start

This Library is a .NET 3.5 Library that can be used either with a .NET projet or PowerShell 3.0.
It has dependencies on Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Runtime.dll, so both these libraries need to be referenced also.
These may be downloaded from Microsoft web site here : SharePoint Foundation 2010 Client Object Model Redistributable

For a .NET projet, simply add project references.
For a PowerShell script, you need to load the assemblies using reflection (see example below). Please be aware that you need to use PowerShell 3.0 in order to use the SharePoint Client Object Model.

Examples

Example using .NET code (C#)

example-csharp.PNG

Example using PowerShell 3.0

example-powershell.PNG

Arnault Nouvel
MVP SharePoint Server

Last edited Dec 19, 2012 at 6:58 AM by anouvel, version 13