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

Cannot call this API with an app-only principal. #4478

Open
harshdamaniahd opened this issue Oct 25, 2024 · 2 comments · May be fixed by #4488
Open

Cannot call this API with an app-only principal. #4478

harshdamaniahd opened this issue Oct 25, 2024 · 2 comments · May be fixed by #4488
Labels
bug Something isn't working

Comments

@harshdamaniahd
Copy link

Cannot call this API with an app-only principal.

What kind of permissions are needed for these commands Set-PnPSiteVersionPolicy -EnableAutoExpirationVersionTrim $false -MajorVersions 100 -ExpireVersionsAfterDays 0 -MajorWithMinorVersions 0

@harshdamaniahd harshdamaniahd added the bug Something isn't working label Oct 25, 2024
@NishkalankBezawada
Copy link
Contributor

Hello @harshdamaniahd

I tried with App only approach and got the same error.

Required permissions for this command is

Type API/ Permission Name Admin consent required
Delegated AllSites.FullControl yes

With below approach using parameters ClientId, DeviceLogin, LaunchBrowser

Connect-PnPOnline -ClientId xxxxxxxx-0000-4xxxx-xxxx-xxxxxxxxxxx -Url "https://xxxx.sharepoint.com/sites/xxxx" -DeviceLogin -LaunchBrowser -Tenant xxxxx

I was able to execute this succesfully

PS C:\Research\PnPCommunity\powershell> Set-PnPSiteVersionPolicy -EnableAutoExpirationVersionTrim $false -MajorVersions 100 -MajorWithMinorVersions 10 -ExpireVersionsAfterDays 200
WARNING: The setting for new libraries takes effect immediately. Please run Get-PnPSiteVersionPolicy to display the newly set values.
WARNING: The setting for existing libraries takes at least 24 hours to take effect. Please run Get-PnPSiteVersionPolicyStatus to check the status.
WARNING: The setting for existing libraries does not trim existing versions.
PS C:\Research\PnPCommunity\powershell>
image

@gautamdsheth I will add required permissions for these two commandlets in the PR #4488

Thanks,
Nish

@harshdamaniahd
Copy link
Author

Thanks I should try this

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