pnp / powershell

PnP PowerShell
https://pnp.github.io/powershell
MIT License
648 stars 336 forks source link

Using Set-PnPWeb -Title -Description, to update Modern Teams Site doesn't retain changed value #3913

Closed TitaAE closed 4 months ago

TitaAE commented 4 months ago

Connect to Exchange Online

$siteurl = https://dev.sharepoint.com/sites/Test2 Connect-ExchangeOnline -UserPrincipalName test@dev.onmicrosoft.com Connect-PnPOnline -Url $siteurl -Interactive

$Web = Get-PnPWeb -Includes RegionalSettings.InstalledLanguages $Web.RegionalSettings.InstalledLanguages

Remove all alternative languages:

$AllLanguages = $Web.RegionalSettings.InstalledLanguages

foreach ($Language in $AllLanguages) { if ($Language.Lcid -ne '1033'){ $web.RemoveSupportedUILanguage($Language.Lcid) $Web.Update() Invoke-PnPQuery } }

Rename Office 365 Group

Set-UnifiedGroup -Identity Test2@dev.onmicrosoft.com -DisplayName "Test2_Rename"

$Newtitle = "Test2_Rename" Set-PnPWeb -Title $Newtitle -Description $Newtitle

Expected behavior Set-PnPWeb -Title should retain the value used for the SharePoint sites title in and not change after refreshing a browser

Actual behavior Run Visual Studio with ISE 7 - call the script to update the sites Title and Description also change M365 group name, open a browser check central admin and name is changed, open browser go to sites url and site Title and Description reverts back to old name after couple minutes. In some articles there is mention if you remove language packs from site then change is permanent, it didn't work.

If this action is done by hand through console (clicking), change is permanent without issue in all categories.

PS Version: PSVersion 7.4.1 PSEdition Core GitCommitId 7.4.1 OS Microsoft Windows 10.0.22621 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

gautamdsheth commented 4 months ago

hi @TitaAE , this is by design and not a bug.

You can use Set-PnPMicrosoft365Group for this.

https://pnp.github.io/powershell/cmdlets/Set-PnPMicrosoft365Group.html

TitaAE commented 4 months ago

Oh really? Do you have any source why is intended so that pnp doesn't work?

TitaAE commented 3 months ago

Not sure if you understood me correctly even with Set-PnPMicrosoft365Group is same behavior, so pnp isn't working?