The Property Or Field 'ServerLibraryVersion' Has Not Been Initialized

Issue Description

When trying to run the PowerShell module using the PnP PowerShell module, we are getting the following error,

Set-PnpTenantSite - The property or the 'ServerLibraryVersion' has not been initialized

The Property Or Field 'ServerLibraryVersion' Has Not Been Initialized


The reason being the PnP library module not getting initialized even after connecting to the SPO module. Remember this requires to have SharePoint admin privileges to your account or an account that has SharePoint admin privileges required to run this command. The command I am trying to run is 

Get-PnPTenantSite -url "<YOURSITEURL>" -Detailed | select SharingCapability

The fix is very simple, for the command you need to add a connection parameter and pass the current connection.

Step 1 - Save the current connection in a variable

$CurrentConnection = Connect-PnPOnline -Url "" -InteractiveStep1

Step 2 - Pass the connection and execute the command

Get-PnPTenantSite -Identity <YOURSITEURL> -Detailed -Connection $CurrentConnection