To run a Rest call against SharePoint Online from PowerShell, we can use this simple script, inspired from https://blog.vgrem.com/2014/02/27/working-with-the-sharepoint-online-rest-service-via-powershell/.

All you need to do first is, install the SharePoint Online Client components or the SharePoint Online PowerShell extensions and copy the files Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll to the same directory as the script below.

A sample could look like this: .\RestAgainstSharePointOnline.ps1 -Url https://{yourtenant}.sharepoint.com/_api/web -UserName {youruser} -Password {yourpassword}

Advertisements