Pnp-powershell: Selecting all properties of a site collection using Get-PnPSite is not supported

Created on 23 Apr 2018  路  5Comments  路  Source: pnp/PnP-PowerShell

Notice: many issues / bugs reported are actually related to the PnP Core Library which is used behind the scenes. Consider carefully where to report an issue:

  1. Are you using Apply-SPOProvisioningTemplate or Get-SPOProvisioningTemplate? The issue is most likely related to the Provisioning Engine. The Provisioning engine is _not_ located in the PowerShell repo. Please report the issue here: https://github.com/officedev/PnP-Sites-Core/issues.
  2. Is the issue related to the cmdlet itself, its parameters, the syntax, or do you suspect it is the code of the cmdlet that is causing the issue? Then please continue reporting the issue in this repo.
  3. If you think that the functionality might be related to the underlying libraries that the cmdlet is calling (We realize that that might be difficult to determine), please first double check the code of the cmdlet, which can be found here: https://github.com/OfficeDev/PnP-PowerShell/tree/master/Commands. If related to the cmdlet, continue reporting the issue here, otherwise report the issue at https://github.com/officedev/PnP-Sites-Core/issues

Reporting an Issue or Missing Feature

Please confirm what it is that your reporting

Missing Feature: Fetching all site properties using Get-PnPSite Cmdlet

Expected behavior

Please describe what output you expect to see from PnP-PowerShell Cmdlets

Should provide me the list of properties for the site collection being queried when i execute the command

Get-PnPSite | Select-Object -Property *

or

Get-PnPSite | fl

Actual behavior

Please describe what you see instead. Please provide samples of HTML output or screenshots

format-default : The collection has not been initialized. It has not been requested or the request has not been executed. It
may need to be explicitly requested.
+ CategoryInfo : NotSpecified: (:) [format-default], CollectionNotInitializedException
+ FullyQualifiedErrorId : Microsoft.SharePoint.Client.CollectionNotInitializedException,Microsoft.PowerShell.Commands.For
matDefaultCommand

Steps to reproduce behavior

Please include complete code samples in-line or linked from gists

Get-PnPSite | Select-Object -Property *

Get-PnPSite | fl

Which version of the PnP-PowerShell Cmdlets are you using?

  • [ ] PnP PowerShell for SharePoint 2013
  • [ ] PnP PowerShell for SharePoint 2016
  • [x] PnP PowerShell for SharePoint Online

What is the version of the Cmdlet module you are running?

(you can retrieve this by executing Get-Module -Name *pnppowershell* -ListAvailable)

2.25.1804.1

How did you install the PnP-PowerShell Cmdlets?

  • [ ] MSI Installed downloaded from GitHub
  • [x] Installed through the PowerShell Gallery with Install-Module
  • [ ] Other means

Kindly add the functionality to select multiple site properties in the Get-PnpSite Command.

Most helpful comment

I am also having this issue, with SharePointPnPPowerShellOnline Version 3.4.1812.2, installed via Install-Module. Is this due to the CSOM issue that Erwin references in #1370?

I was able to retrieve all (I think) of the properties by using Get-PnPSite | Get-Member -MemberType Property, and then see the values for them with Get-PnPSite | select Property1,Property2, etc. It's not the best workaround ever, since it returns (for example) Microsoft.SharePoint.Client.User for | select Owner, whereas Get-SPOSite | select Owner returns the team GUID or SCA UPN. However, I'm also not used to working with CSOM, which is why I'm looking for more information on this error.

All 5 comments

I am also having this issue, with SharePointPnPPowerShellOnline Version 3.4.1812.2, installed via Install-Module. Is this due to the CSOM issue that Erwin references in #1370?

I was able to retrieve all (I think) of the properties by using Get-PnPSite | Get-Member -MemberType Property, and then see the values for them with Get-PnPSite | select Property1,Property2, etc. It's not the best workaround ever, since it returns (for example) Microsoft.SharePoint.Client.User for | select Owner, whereas Get-SPOSite | select Owner returns the team GUID or SCA UPN. However, I'm also not used to working with CSOM, which is why I'm looking for more information on this error.

@SwagataChaudhuri @enetics-katharine Just wondering if you have ever found a solution for this. I have the latest version of the SPO Pnp module installed, from the PSGallery, and single Get-Pnp* cmdlet that I want to use has this issue.

To minimize the size of the traffic between your client and SPO most (maybe all) Get- cmdlets only retrieve a few of the properties for the objects they're getting. They don't retrieve every Property for every object. Imagine what that would look like if you ran Get-PnPListItem against a document library with 4000 items. Like enetics-katharine mentioned, you can pipe through Get-Member -MemberType Property to get all of the properties. Then use Get-PnPProperty to retrieve the values for the properties you want that weren't retrieved during the initial Get-. Here's a quick example:

image

Get-PnPSite | select usage
Get-PnPProperty $(Get-PnPSite) -Property usage

If you get a collection then you'll need to run Get-PnPProperty through a ForEach loop and retrieve the property for each object.

Check out the help for Get-PnPProperty and let me know if there is any way we can make it easier to use.

Thank you very much @ToddKlindt . That is priceless info you have provided us with. I'm new enough to PnP PowerShell that it would have taken me a long time to figure this out on my own.

I'm glad you posted in here before you got too frustrated or spent too much time on it. :)

Was this page helpful?
0 / 5 - 0 ratings