Skip to content

Instantly share code, notes, and snippets.

@BasantPandey
Created July 14, 2017 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BasantPandey/35d9effa366fdd8698688039db71e7f5 to your computer and use it in GitHub Desktop.
Save BasantPandey/35d9effa366fdd8698688039db71e7f5 to your computer and use it in GitHub Desktop.
The Get-PnPProperty is same as Load method just add the properties to the context
Import-Module 'C:\Users\basantp\Documents\PNP Blog Section\Code\SharePointPnPPowerShell2013\SharePointPnP.PowerShell.2013.Commands.dll';
try {
Set-PnPTraceLog -On -LogFile 'C:\Users\basantp\Documents\PNP Blog Section\Code\traceoutput.txt' -Level Error -Delimiter ","
$Url1 = "<URL>"
Connect-PnPOnline -Url $Url1 -CurrentCredentials -ErrorAction Stop
Write-host "Site $Url1 connected".
$web =Get-PnPWeb
Get-PnPProperty -ClientObject $web -Property Id
"Only print the ID : $($web.Id)"
"IsMultilingual value is : $($web.IsMultilingual)"
"List Count: $($web.Lists.Count)"
#This value not going to be print becase this value not loaded by the context using Get-PnPProperty method
Get-PnPProperty -ClientObject $web -Property Lists , IsMultilingual
"Only print the title : $($web.Title)" #Title is the default property
"IsMultilingual value is : $($web.IsMultilingual)"
"List Count: $($web.Lists.Count)"
catch {
Write-Host "Site not found"
}
finally{
Disconnect-PnPOnline
}
@BasantPandey
Copy link
Author

This code snippets related to my post on Office 365 With PNP PowerShell 2013: Base Cmdlets .

As the PNP documentation I found some examples and I tried but no luck. As I found some difficulties to get this run. May be I am not expert in PS scripting so in this post. I mentioned simple way to write.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment