Open ypcode opened 5 years ago
FYI, I just noticed that only happens when I connect using WebLogin (with my admin account), with direct credentials, it works just fine
I can confirm that I'm seeing the same error when using UserWebLogin
Connect-PnPOnline -Url "https://<TENANT>.sharepoint.com/<PATH>/<SITE>" -UseWebLogin;
Get-PnPConnection;
The error message returned is:
Get-PnPSiteDesign : The remote server returned an error: (403) Forbidden. At line:1 char:1
- Get-PnPSiteDesign
+ CategoryInfo : NotSpecified: (:) [Get-PnPSiteDesign], WebException + FullyQualifiedErrorId : System.Net.WebException,SharePointPnP.PowerShell.Commands.GetSiteDesign
But it works fine when using Credentials
Connect-PnPOnline -Url "https://<TENANT>.sharepoint.com/<PATH>/<SITE>" -Credentials (Get-Credential);
Get-PnPConnection;
Is there any progress in a fix?
To get the Get-PnPConnection to work with UserWebLogin you need to connect to your SharePoint Admin site like so:
Connect-PnPOnline -Url "https://<TENANT>-admin.sharepoint.com" -UseWebLogin;
Get-PnPConnection;
This does mean that PnP example below is not good, as you would applying the site design to the SharePoint Admin Center...
Get-PnPSiteDesign | ?{$_.Title -eq "Demo"} | Invoke-PnPSiteDesign
Instead you could do something like this:
Connect-PnPOnline -Url "https://<TENANT>-admin.sharepoint.com" -UseWebLogin;
$siteDesign = Get-PnPSiteDesign | ?{$_.Title -eq $row.SiteDesignName};
Invoke-PnPSiteDesign -Identity $siteDesign.Id -WebUrl "https://<TENANT>.sharepoint.com/<PATH>/<SITE>";
Noting forgetting to disconnect of cause :)
Disconnect-PnPOnline;
Apparently Add-PnPSiteDesignTask has superseded the above CmdLet, see Microsoft's documentation for more info: https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/add-pnpsitedesigntask?view=sharepoint-ps
Reporting an Issue or Missing Feature
I get an issue when I try either Get-PnPSiteDesign or Get-PnPSiteScript in order the get the list of designs (or scripts) I tried as well specifying the Id of script or design but get the same NullReferenceException
Expected behavior
Get the list of site designs and site scripts in my tenant
Actual behavior
Steps to reproduce behavior
Which version of the PnP-PowerShell Cmdlets are you using?
What is the version of the Cmdlet module you are running?
The latest march 2019 release ModuleType Version Name ExportedCommands
Binary 3.7.1903.0 SharePointPnPPowerShellOnline
How did you install the PnP-PowerShell Cmdlets?