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

Added RequiredPermissionWarnings to 4 different commandlets #4488

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

NishkalankBezawada
Copy link
Contributor

@NishkalankBezawada NishkalankBezawada commented Oct 28, 2024

Before creating a pull request, make sure that you have read the contribution file located at

https://github.com/pnp/powerShell/blob/dev/CONTRIBUTING.md

Type

  • Bug Fix
  • New Feature
  • Sample

Related Issues?

Fixes #X, partially fixes #4478, mentioned in #4472 and #4353 , etc.

What is in this Pull Request ?

Add warning to GetAvailableSensitivityLabel, GetDeletedFlow, GetListItem, GetSite commandlets about required permissions. Details below,

Get-PnPAvailableSensitivityLabel

PS C:\Research\PnPCommunity\powershell> Get-PnPAvailableSensitivityLabel
Get-PnPAvailableSensitivityLabel: Forbidden (403):
PS C:\Research\PnPCommunity\powershell>
PS C:\Research\PnPCommunity\powershell> Get-PnPAvailableSensitivityLabel
WARNING: Current access token lacks the following required delegated permission scope on the resource Microsoft Graph:
InformationProtectionPolicy.Read

Get-PnPAvailableSensitivityLabel: Forbidden (403):
PS C:\Research\PnPCommunity\powershell>

Get-PnPSite

PS C:\Research\PnPCommunity\powershell> Get-PnPSite
Get-PnPSite: The remote server returned an error: (401) Unauthorized.
PS C:\Research\PnPCommunity\powershell>

PS C:\Research\PnPCommunity\powershell> Get-PnPSite
WARNING: Current access token lacks one of the following required application permission scopes on the resource SharePoint Online:
Sites.Selected
 or
Sites.Read.All
 or
Sites.ReadWrite.All
 or
Sites.Manage.All
 or
Sites.FullControl.All

Get-PnPSite: The remote server returned an error: (401) Unauthorized.
PS C:\Research\PnPCommunity\powershell>

Get-PnPListItem

PS C:\Research\PnPCommunity\powershell> Get-PnPListItem -List "DynamicFormTest" -PageSize 1000
Get-PnPListItem: The remote server returned an error: (401) Unauthorized.
PS C:\Research\PnPCommunity\powershell>
PS C:\Research\PnPCommunity\powershell> Get-PnPListItem -List "DynamicFormTest" -PageSize 1000
WARNING: Current access token lacks one of the following required application permission scopes on the resource SharePoint Online:
Sites.Selected
 or
Sites.Read.All
 or
Sites.ReadWrite.All
 or
Sites.Manage.All
 or
Sites.FullControl.All

Get-PnPListItem: The remote server returned an error: (401) Unauthorized.
PS C:\Research\PnPCommunity\powershell>

Get-PnPSiteVersionPolicy

image

Set-PnPSiteVersionPolicy

image

Guidance

  • You can delete this section when you are submitting the pull request.*
  • Please update this PR information accordingly. We use this as part of our release notes in monthly communications.
  • Please target your PR to Dev branch. If you do not target the Dev branch we will not accept this PR.

@NishkalankBezawada NishkalankBezawada marked this pull request as ready for review October 30, 2024 15:32
@NishkalankBezawada NishkalankBezawada marked this pull request as draft October 30, 2024 16:59
@NishkalankBezawada NishkalankBezawada marked this pull request as ready for review October 30, 2024 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot call this API with an app-only principal.
1 participant