pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
990 stars 663 forks source link

Get-PnPList in Azure PowerShell runbook - inconsistency #2907

Open joostvdlinden opened 4 years ago

joostvdlinden commented 4 years ago

If you have a question and are not reporting a bug, please go to:

https://github.com/pnp/pnp-powershell/discussions

Notice

Many 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-PnPProvisioningTemplate or Get-PnPProvisioningTemplate? 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/pnp/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 might be difficult to determine), please first double check the code of the cmdlet, which can be found here: https://github.com/pnp/PnP-PowerShell/tree/master/Commands. If related to the cmdlet, continue reporting the issue here, otherwise report the issue at https://github.com/pnp/PnP-Sites-Core/issues

Reporting an Issue or Missing Feature

Please confirm what it is that your reporting I am using PnP PowerShell inside an Azure Runbook to break list permissions. I am doing this for 3 lists, Documents (default library), SitePages and SiteAssets. The cmdlet for SiteAssets does not seem to work.

However, if I create a new separate Runbook, use the very same code (only for the Site Assets library), it works...

Expected behavior

Please describe what output you expect to see from PnP-PowerShell Cmdlets All cmdlets to work consistently

Actual behavior

Please describe what you see instead. Please provide samples of HTML output or screenshots I am getting this error in my next action:

Set-PnPList : Cannot bind argument to parameter 'Identity' because it is null. At line:85 char:65 + ... ions = Set-PnPList -BreakRoleInheritance -Identity $SiteAssetsList.Id + ~~~~~~ + CategoryInfo : InvalidData: (:) [Set-PnPList], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,PnP.PowerShell.Commands.Lists.SetList

Steps to reproduce behavior

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

`function setsitepages { $visitorsgroup = Get-PnPGroup -AssociatedVisitorGroup $membergroup = get-pnpgroup -AssociatedMemberGroup $ownergroup = get-pnpgroup -associatedOwnerGroup

$ListURL = "SitePages" $SitePagesList = Get-PnPList -Identity $ListURL

$BreakPermissions = Set-PnPList -BreakRoleInheritance -Identity $SitePagesList.Id $addVisitors = Set-PnPListPermission -Identity $SitePagesList.Id -Group $visitorsgroup.Id -AddRole "Lezen" $addMembers = Set-PnPListPermission -Identity $SitePagesList.Id -Group $membergroup.Id -AddRole "Bijdragen" $addOwners = Set-PnPListPermission -Identity $SitePagesList.Id -Group $ownergroup.Id -AddRole "Volledig beheer"

write-output "Variabele instellen" $ListURL = "SiteAssets" write-output "Variabele ingesteld"

write-output "Lijst ophalen" $SiteAssetsList = Get-PnPList -Identity $ListURL write-output "Lijst opgehaald"

write-output "break permissions" $BreakPermissions = Set-PnPList -BreakRoleInheritance -Identity $SiteAssetsList.Id write-output "machtigingen verbroken"

write-output "rechten zetten" $addVisitors = Set-PnPListPermission -Identity $SiteAssetsList.Id -Group $visitorsgroup.Id -AddRole "Bijdragen" $addMembers = Set-PnPListPermission -Identity $SiteAssetsList.Id -Group $membergroup.Id -AddRole "Bewerken" $addOwners = Set-PnPListPermission -Identity $SiteAssetsList.Id -Group $ownergroup.Id -AddRole "Volledig beheer" write-output "rechten gezet" }`

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

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

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

How did you install the PnP-PowerShell Cmdlets?