This repository has been archived by the owner on Jan 19, 2021. It is now read-only.
Replies: 2 comments 1 reply
-
I would agree with DeGe78 |
Beta Was this translation helpful? Give feedback.
0 replies
-
@DeGe78 @cbmavic This was my learning journey to achieve that:
$tenantName = "tenantname"
$siteName = "sitename"
Connect-PnPOnline -Url "https://$tenantName.sharepoint.com/sites/$siteName" -UseWebLogin
Get-PnPFeature -Scope Site
# Hint: Search for DisplayName 'ModernAudienceTargeting' in the output
$featureDefinitionId = (Get-PnPFeature -Scope Site | Where DisplayName -eq "ModernAudienceTargeting").DefinitionId
#region Enable PnPFeature 'ModernAudienceTargeting' on ALL Communication Sites
$tenantName = "tenantname"
Connect-PnPOnline -Url https://$tenantName-admin.sharepoint.com -UseWebLogin
$CommunicationSites = Get-PnPTenantSite -Template SITEPAGEPUBLISHING#0
foreach($Site in $CommunicationSites){
Connect-PnPOnline -Url $Site.Url -UseWebLogin
Get-PnPFeature -Scope Site | Where DisplayName -eq ""
Enable-PnPFeature -Scope Site -Identity $featureDefinitionId # ModernAudienceTargeting
Write-Host "Enabled Site scoped PnPFeature 'ModernAudienceTargeting' on Communication Site: $($Site.Url)"
}
#endregion |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi.
It would be awesome if audience targeting could be activated programmatically on both menus and site pages library.
Beta Was this translation helpful? Give feedback.
All reactions