0

Ok this site recently got switched form a modern site to a classic site and now I cannot use anything on the site to include turning on and off features with powershell. This is a sharepoint online site with office 365 permissions. I used to be able to use powershell on this site but now i am only getting a 403 error. Any help would be greatly appreciated.

Note: This error was specific to a single site collection. I was able to run all pnp commands on other site collections.

Connect-PnPOnline

I enter the URl and credentials without fail, but the minute I run

Get-PnPProvisioningTemplate -Out "example-Template.xml"

or

Set-PnPList -Identity "Some Library" -ForceCheckout $false

I will get the following error

  Set-PnPList : The remote server returned an error: (403) Forbidden.
At line:1 char:1
+ Set-PnPList -Identity "Some Library" -ForceCheckout $false
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Set-PnPList], WebException
    + FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Lists.SetList

I ran the log against it also and got this error in line one

 powershell.exe Error: 0 : 2020-09-16 08:03:52.1674 [OfficeDevPnP.Core] [0] [Error] ExecuteQuery threw following exception: System.Net.WebException: The remote server returned an error: (403) Forbidden.
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
2
  • Please check permissions on the site collection and the list, normally this error is related to permission issue. Also update the SharePoint Online Management Shell to the latest version, and compare the results.
    – Julie_MSFT
    Sep 17, 2020 at 9:46
  • Julie, permissions were fine and I removed older versions of the management shrell. This did not solve my issue. I had another user with the exact same permissions run the exact same commands and it worked for him.
    – hittle08
    Sep 17, 2020 at 13:03

1 Answer 1

0

I went through multiple steps to solve this issue.

First I checked permissions to see if I was having an error with the group permissions.

  • I removed my permissions from the group then re added them (No change)
  • I added myself with full control outside of the group (no change)
  • I removed older versions of the managment counsel and pnp and made sure mine was updated to the most current version. (No change)

Fix:

The thing that fixed it was changing the -Lockstate

Set-PnPTenantSite -Url https://target.sharepoint.com/sites/traget-site -LockState Unlock
1
  • Congratulations on solving this issue and thanks for sharing your solution.You could mark you reply as answer, It will do great help to those who meet the similar question in this forum.
    – Julie_MSFT
    Sep 21, 2020 at 6:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.