共用方式為


Quickly Verify the Version of a SharePoint Online Tenant

I have put together a quick script that can be used to confirm the version number of a SharePoint Online Tenant.

The version number itself is meaningless however any change to this value should be a good indication that an update has been deployed to a tenant.

This then gives you the opportunity to perform some testing of any customizations that you have or perhaps to see if that new feature you have been waiting for has been enabled in your tenant. The script could be run daily as part of a Scheduled Task (with some minor adjustments).

To run the script update highlighted with the tenant name and then execute - it will prompt for credentials of an account that has Site Collection admin rights to the Site specified in the $Site vairable.

#Add references to SharePoint client assemblies and authenticate to Office 365 site
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#Obtain username and password
$Username = Read-Host -Prompt "Please enter your username"
$Password = Read-Host -Prompt "Please enter your password" -AsSecureString

#Connect to root Site Collection and obtain version
$Site = "https://tenant.sharepoint.com"
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($Site)
$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username,$Password)
$Context.Credentials = $Creds
$Context.ExecuteQuery()

Write-Host "Server Version:" $Context.ServerVersion -ForegroundColor Green

Script in action

Brendan Griffin - @brendankarl

Comments