From 82a3fc29cd3fbea4a3fbb3610bb867b9439d3d80 Mon Sep 17 00:00:00 2001 From: Gautam Sheth Date: Wed, 26 Jun 2024 21:40:22 +0300 Subject: [PATCH] Fix #3783 : issue with audience targeting in modern lists --- src/lib/PnP.Framework/Extensions/ListExtensions.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/PnP.Framework/Extensions/ListExtensions.cs b/src/lib/PnP.Framework/Extensions/ListExtensions.cs index 78ca11602..98f54e041 100644 --- a/src/lib/PnP.Framework/Extensions/ListExtensions.cs +++ b/src/lib/PnP.Framework/Extensions/ListExtensions.cs @@ -2304,6 +2304,9 @@ public static void EnableClassicAudienceTargeting(this List list) public static void EnableModernAudienceTargeting(this List list) { + var siteContext = list.ParentWeb.Context as ClientContext; + siteContext.Site.ActivateFeature(new Guid("bc13eaf7-67c7-4f85-a80f-a4b0dae5e5bd")); + // TODO Need to add filter for Site Pages and Documents Library only for modern targeting. if (!list.FieldExistsByName(Constants.ModernAudienceTargetingInternalName) && !list.FieldExistsByName(Constants.ModernAudienceTargetingMultiLookupInternalName))