Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Set-PnPListPermission not throwing exception if list does not exist #1882

Closed
1 of 6 tasks
jolscr opened this issue May 20, 2022 · 4 comments · Fixed by #1891
Closed
1 of 6 tasks

[BUG] Set-PnPListPermission not throwing exception if list does not exist #1882

jolscr opened this issue May 20, 2022 · 4 comments · Fixed by #1891
Assignees
Labels
bug Something isn't working

Comments

@jolscr
Copy link

jolscr commented May 20, 2022

Reporting an Issue or Missing Feature

Set-PnPListPermission not throwing exception if list doesn't exist.

Expected behavior

If list doesn't exist, I want to receive an erreur to catch it with a try-catch.

Actual behavior

The code continues to run and permission is not given.

Steps to reproduce behavior

Parameters User and Role is good in my case and permission is given if the list exist.

Set-PnPListPermission -Identity "/Lists/listNameDontExist" -User $IdentityObject -AddRole $role -Connection $ConnectionSite

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

1.10.0 PnP.PowerShell

Which operating system/environment are you running PnP PowerShell on?

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify
@jolscr jolscr added the bug Something isn't working label May 20, 2022
@gautamdsheth gautamdsheth self-assigned this May 21, 2022
@gautamdsheth
Copy link
Collaborator

Are you use, am not able to reproduce it ?
Also, the identity parameter is for the List Item ID not for the name of the list
It always throws error if the list doesnt exist:

image

@gautamdsheth gautamdsheth removed their assignment May 21, 2022
@jolscr
Copy link
Author

jolscr commented May 21, 2022

You use not the same cmdlet. On list not on listitem. :)

@gautamdsheth gautamdsheth self-assigned this May 21, 2022
gautamdsheth added a commit to gautamdsheth/powershell that referenced this issue May 21, 2022
@gautamdsheth
Copy link
Collaborator

@jolscr -yep my bad , sorry. Thanks for pointing that out . Have a sent a PR to fix it 😊

@gautamdsheth
Copy link
Collaborator

@jolscr - have fixed it, will be available in tomorrows nightly build.
Thanks for spotting and raising the issue !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants