SharePoint Online: Get Site Properties using PowerShell

Requirement: Get site properties in SharePoint Online using PowerShell

SharePoint Online: PowerShell to Get Site Properties

You can get SharePoint Online site properties using SharePoint Management Shell. 

#Set Parameters

#Connect to SharePoint Online Admin Center
Connect-SPOService -Url $AdminSiteURL -Credential (Get-Credential)

#Get site properties
Get-SPOSite $SiteURL | Select *

This PowerShell gets all properties of the site

sharepoint online powershell get site properties

SharePoint Online: PowerShell to Get Web Properties

Say, you want to get the last modified date of a SharePoint Online site using PowerShell, Here is the CSOM way to get site properties:

#Load SharePoint CSOM Assemblies
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"
#Set Parameters
$SiteURL= ""

#Get Credentials to connect
$Cred = Get-Credential

#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
#Get the web
$Web = $Ctx.web

#Get Properties of the Web
$SiteProperties = New-Object PSOBject
$SiteProperties | Add-Member NoteProperty Title($Web.Title)
$SiteProperties | Add-Member NoteProperty Url($Web.Url)
$SiteProperties | Add-Member NoteProperty ServerRelativeUrl($Web.ServerRelativeUrl)
$SiteProperties | Add-Member NoteProperty Description($Web.Description)
$SiteProperties | Add-Member NoteProperty Created($Web.Created)
$SiteProperties | Add-Member NoteProperty LastModified($Web.LastItemModifiedDate)
$SiteProperties | Add-Member NoteProperty AllowRSSFeeds($Web.AllowRssFeeds)
$SiteProperties | Add-Member NoteProperty CustomMasterUrl($Web.CustomMasterUrl)
$SiteProperties | Add-Member NoteProperty EnableMinimalDownload($Web.EnableMinimalDownload)
$SiteProperties | Add-Member NoteProperty ID($Web.Id)
$SiteProperties | Add-Member NoteProperty Language($Web.Language)
$SiteProperties | Add-Member NoteProperty MasterUrl($Web.MasterUrl)
$SiteProperties | Add-Member NoteProperty QuickLaunchEnabled($Web.QuickLaunchEnabled)
$SiteProperties | Add-Member NoteProperty RecycleBinEnabled($Web.RecycleBinEnabled)
$SiteProperties | Add-Member NoteProperty TreeViewEnabled($Web.TreeViewEnabled)
$SiteProperties | Add-Member NoteProperty UIVersion($Web.UIVersion)
$SiteProperties | Add-Member NoteProperty WebTemplate($Web.WebTemplate)
$SiteProperties | Add-Member NoteProperty ExcludeFromSearch($Web.NoCrawl)


Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply