Property Bag value got lost after creating modern site
Category
- [ ] Question
- [ ] Typo
- [x] Bug
- [ ] Additional article idea
Expected or Desired Behavior
Property Bag value should be kept stored after setting it.
Observed Behavior
When we set a Property Bag value immediately after creating a modern site and enable scripting. The value got lost after a few seconds. When we reset it after that, the value keeps stored.
Steps to Reproduce
- Create Modern Site with New-PnPSite
- Set NoScriptSite to false
- Set Property Bag Value
- Check if value is kept stored.
See script below:
$adminConnection = Connect-PnPOnline -Url "https://contoso-admin.sharepoint.com" -Credentials PnPCreds -ReturnConnection
$siteTitle = "[SiteTitle]"
$siteUrl = New-PnPSite -Type TeamSite -Title $siteTitle -Alias $siteTitle -Connection $adminConnection -ErrorAction Stop
$property = "TEST"
Set-PnPTenantSite -Connection $adminConnection -Url $siteUrl -NoScriptSite:$false -Sharing ExistingExternalUserSharingOnly
Connect-PnPOnline -Url $siteUrl -Credentials PnPCreds
Set-PnPPropertyBagValue -Key $property -Value $siteTitle
function CheckPropertyBagValue() {
do{
$prop = Get-PnPPropertyBag -Key $property
Write-Host "Property has value: $prop" -ForegroundColor Green
} while($prop.Length -gt 0)
Write-Host "Property is empty!!!" -ForegroundColor Red
}
CheckPropertyBagValue
I am also seeing this issue. It does not happen always though... Same thing also happens on communication sites. Also after creating a modern site many different elements get renamed or recreated (e.g. Site Groups). This is all related to the async provisioning of modern sites. What we need is an event to find out when a modern site is really provisioned...
This issue is being closed as part of an issue list cleanup project. Issues with no activity in the past 6 months that aren't tracked by engineering as bugs were closed as part of this inititive. If this is still an issue, please follow the steps outlined to re-open the issue.