Cross-Platform interactive command shell for SharePoint Online
spo-shell is a cross-platform implementation of SharePoint shell commands written in straight ES6. No powershell cmdlets and confusing PnP installs.
$ npm install @beyond-sharepoint/spo-shell -g$ spo-shellspo:/$
And start working with SharePoint Online on your terms!
insert snazzy gif
Want to upload the contents of an entire folder? No worries, mon.
spo:/Shared Documents$ up ./MyApp/ .
Yeah, but what about recursively, and only update files if the source is newer? Got that too.
spo:/Shared Documents$ up ./MyApp/ . --Recurse --Update
What if I want to do some local dev, but sync those changes with SPO.. but use checksums to determine differences, like rsync? Yep.
spo:/Shared Documents$ up ./MyApp/ . -r -u --Checksum --Watch
spo-shell lets you peruse your SPO environment and perform hassle-free site content provisioning, no add-ins. Simple.
We got 'ya. spo-shell has a bunch of SPO/SPPnP cmdlets built-in... in a powershelly like fashion.
spo:/Shared Documents$ Set-SPOWelcomePage --Url "/mynewwelcomepage.aspx"
The goal is to have a majority of these commands (at least the ones that make sense) available. See the roadmap
spo-shell has some basic powershell commands built-in. For instance, Select-Object:
spo:/$ Get-SPOSite | select --Property Url --Property Owner --ExpandProperty Owner
Url: ''Owner:__metadata:id: '(5)'uri: '(5)'type: 'SP.User'Groups: __deferred: uri: '(9)/Groups'Id: 9IsHiddenInUI: falseLoginName: 'c:0-.f|rolemanager|s-1-2-34-56798304-345345345-345345345345345345'Title: 'Company Administrator'PrincipalType: 4Email: ''IsShareByEmailGuestUser: falseIsSiteAdmin: trueUserId: null
Notice that these commands are SPO "Aware", in the above example, ExpandProperty actually expanded the deferred url in the returned SPSite object.
Got 'ya there too:
spo:/$ Get-SPOSite | grep url -i
ServerRelativeUrl: '/'ShowUrlStructure: falseUrl: '' }
Absoutely, spo-shell provides an implementation against the SharePoint Online REST api
Simply import the module, authenticate, and call the desired methods.
const spo = ;const spoApi = spoapi;var spoContext = spo;spoApi;
With the spo-shell api, you can automate SPO administration within Gulp tasks, for example, with your SharePoint Framework project.
Excellent, I'm glad you're on the same page. Good developers use good automation tools.
insert code sample with a couple gulp tasks
spo-shell requires NodeJS > 6.0. with node installed, simply execute the following:
$ npm install @beyond-sharepoint/spo-shell -g
now execute spo-shell
On windows the steps are much the same, I suggest using Chocolatey to deploy the required bits.
C:\> cinst nodejs.install python2 -y
Now run the same npm install command:
C:\> npm install @beyond-sharepoint/spo-shell -g
Now run spo-shell.
The goal is to have a majority of Sharepoint PowerShell cmdlets as well as Office PnP cmdlets implemented along with powershell-like features.
Here's what's currently supported, and is rapidly expanding:
In interactive mode, spo-shell can read the SharePoint URL, Username and Password through environment variables.
spo-shell_tenanturl: URL to the SPO Tenant spo-shell_username: SPO Username spo-shell_password: SPO Password
If a file named .env file exists in the installation folder, spo-shell will use those settings.
It's suggested to do something similar when writing your own JS scripts or gulp tasks.
spo-shell allows one to interact with SharePoint online in an interactive manner.
spo-shell is also cross-platform and has less installation dependencies -- it can be fully scriped via popular command line tools.
If one is already familiar with developent via SharePoint Framework then using spo-shell is a symbiotic solution.
Sure, but there's not a SPO Powershell for .net core. Yet (?)
I'm not, Scotty. All interactions with SharePoint Online are through the documented REST services.
Treat SharePoint as a service (SPaaS)
Common File/Folder manipulation is performed via console like commands. (cd/mkdir/etc)
Interaction with the actual SharePoint objects are through the Powershell-esque commands and return the actual object (Get-SPOFolderByServerRelativeUrl, etc)
Just me. Feel free to submit PRs and I'll be happy to add you.
ISC © Sean McLellan
Much <3 to Vorpal without which this all wouldn't be possible.