question

Srini-4386 avatar image
0 Votes"
Srini-4386 asked ·

Unable to remove the SPO site header using PNP shell

Hi Guys,

I'm getting an error while removing the SPO page header (GetmyData)while running this script. And this is happening recently not sure why ? any advise
I'm running with administrator access

How to remove title header in the SPO page

$PageName = "GetMyData"
$LoginUrl = "https://contoso.sharepoint.com/sites/GetMyData"
Connect-PnPOnline -Url $LoginUrl -UseWebLogin
Set-PnPPage -Identity $PageName -LayoutType Home



79371-pnp-error.jpg


office-sharepoint-onlineoffice-sharepoint-server-administration
pnp-error.jpg (289.1 KiB)
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Srini-4386 avatar image
0 Votes"
Srini-4386 answered ·

Jerry i've managed to fix the issue using another script here below thanks for your responses


remove-header-image-banner-from-sharepoint-modern-pages


·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Jerryzy avatar image
0 Votes"
Jerryzy answered ·

Hi @Srini-4386 ,

Did the -UseWebLogin pop up a credential window for selecting the user account?

If not, then it will will automatically use the cached credential which could be not the account who have the permission for the site, you can use

-SPOManagementShell -ClearTokenCache append like this which will clear cached credential and force the credential window pop up:



 Import-Module -Name SharePointPnPPowerShellOnline
    
 $PageName = "GetMyData"
 $LoginUrl = "https://contoso.sharepoint.com/sites/GetMyData/";
 Connect-PnPOnline -Url $LoginUrl -SPOManagementShell -ClearTokenCache;
 Set-PnPPage -Identity $PageName -LayoutType Home

The -SPOManagementShell -ClearTokenCache needs to install the SharePointPnPPowerShellOnline (not the new PnP.PowerShell)

Reference:

Connect-PnPOnline: unwanted credential caching

Thanks
Best Regards


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 5 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Jerry now i got a different error. And prompted to include verbose but still no go

PFA


79460-pnp.jpg


0 Votes 0 ·
pnp.jpg (372.7 KiB)

Please firstly install the SharePointPnPPowerShellOnline with this command:

Install-Module -Name SharePointPnPPowerShellOnline -RequiredVersion 3.2.1810.0 -AllowClobber

0 Votes 0 ·

Thank you after installing . Getting a forbidden with some errors

pfa79689-page-not-found.jpg


0 Votes 0 ·
page-not-found.jpg (453.7 KiB)
Show more comments