From 341770ee066aa30a0b6c82ef238899f1671b5826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Angel=20Garc=C3=ADa=20Mart=C3=ADnez?= Date: Wed, 19 Oct 2022 12:41:14 +0200 Subject: [PATCH 1/5] Check owners if null before calling AddUnifiedGroupMembers If Owners is null AddUnifiedGroupMembers is giving an exception. Happening this if creating a new TeamSite (no owners defined) --- src/lib/PnP.Framework/Sites/SiteCollection.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/PnP.Framework/Sites/SiteCollection.cs b/src/lib/PnP.Framework/Sites/SiteCollection.cs index ab3b89434..3002b4c02 100644 --- a/src/lib/PnP.Framework/Sites/SiteCollection.cs +++ b/src/lib/PnP.Framework/Sites/SiteCollection.cs @@ -539,7 +539,9 @@ public static async Task CreateTeamSiteViaGraphAsync(ClientContex if (group != null && !string.IsNullOrEmpty(group.SiteUrl)) { - Graph.UnifiedGroupsUtility.AddUnifiedGroupMembers(group.GroupId, siteCollectionCreationInformation.Owners, graphAccessToken); + if (siteCollectionCreationInformation.Owners!=null){ + Graph.UnifiedGroupsUtility.AddUnifiedGroupMembers(group.GroupId, siteCollectionCreationInformation.Owners, graphAccessToken); + } // Try to configure the site/group classification, if any if (!string.IsNullOrEmpty(siteCollectionCreationInformation.Classification)) { From 91e5991afeee4f71fe295478ac0828496ec052dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Angel=20Garc=C3=ADa=20Mart=C3=ADnez?= Date: Tue, 25 Oct 2022 12:36:17 +0200 Subject: [PATCH 2/5] Export FieldRef with resources to support multilanguage Adding support for exporting FieldRef DisplayName with multlanguage resources. --- .../ObjectHandlers/ObjectListInstance.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/PnP.Framework/Provisioning/ObjectHandlers/ObjectListInstance.cs b/src/lib/PnP.Framework/Provisioning/ObjectHandlers/ObjectListInstance.cs index e2490feac..545d034df 100644 --- a/src/lib/PnP.Framework/Provisioning/ObjectHandlers/ObjectListInstance.cs +++ b/src/lib/PnP.Framework/Provisioning/ObjectHandlers/ObjectListInstance.cs @@ -2815,10 +2815,20 @@ private ListInstance ExtractFields(Web web, List siteList, List conten if (addField) { + var fieldTitle = field.Title; + if (creationInfo.PersistMultiLanguageResources) + { + var escapedFieldTitle = siteList.Title.Replace(" ", "_")+"_"+field.Title.Replace(" ", "_"); + if (UserResourceExtensions.PersistResourceValue(field.TitleResource, $"Field_{escapedFieldTitle}_DisplayName", template, creationInfo)) + { + fieldTitle = $"{{res:Field_{escapedFieldTitle}_DisplayName}}"; + } + } + list.FieldRefs.Add(new FieldRef(field.InternalName) { Id = field.Id, - DisplayName = field.Title, + DisplayName = fieldTitle, Required = field.Required, Hidden = field.Hidden, }); From b2d26cb64c4a3ab148cbf67201de8054f84b0129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Angel=20Garc=C3=ADa=20Mart=C3=ADnez?= Date: Tue, 25 Oct 2022 12:45:32 +0200 Subject: [PATCH 3/5] revert previous change --- src/lib/PnP.Framework/Sites/SiteCollection.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/PnP.Framework/Sites/SiteCollection.cs b/src/lib/PnP.Framework/Sites/SiteCollection.cs index 3002b4c02..d7ee581bb 100644 --- a/src/lib/PnP.Framework/Sites/SiteCollection.cs +++ b/src/lib/PnP.Framework/Sites/SiteCollection.cs @@ -539,9 +539,8 @@ public static async Task CreateTeamSiteViaGraphAsync(ClientContex if (group != null && !string.IsNullOrEmpty(group.SiteUrl)) { - if (siteCollectionCreationInformation.Owners!=null){ - Graph.UnifiedGroupsUtility.AddUnifiedGroupMembers(group.GroupId, siteCollectionCreationInformation.Owners, graphAccessToken); - } + Graph.UnifiedGroupsUtility.AddUnifiedGroupMembers(group.GroupId, siteCollectionCreationInformation.Owners, graphAccessToken); + // Try to configure the site/group classification, if any if (!string.IsNullOrEmpty(siteCollectionCreationInformation.Classification)) { From 03ffe6d5d2f334f518e3d970487bdc705136c1fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Angel=20Garc=C3=ADa=20Mart=C3=ADnez?= Date: Tue, 25 Oct 2022 12:46:57 +0200 Subject: [PATCH 4/5] revert changes --- src/lib/PnP.Framework/Sites/SiteCollection.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib/PnP.Framework/Sites/SiteCollection.cs b/src/lib/PnP.Framework/Sites/SiteCollection.cs index d7ee581bb..74ba34b2f 100644 --- a/src/lib/PnP.Framework/Sites/SiteCollection.cs +++ b/src/lib/PnP.Framework/Sites/SiteCollection.cs @@ -539,8 +539,7 @@ public static async Task CreateTeamSiteViaGraphAsync(ClientContex if (group != null && !string.IsNullOrEmpty(group.SiteUrl)) { - Graph.UnifiedGroupsUtility.AddUnifiedGroupMembers(group.GroupId, siteCollectionCreationInformation.Owners, graphAccessToken); - + Graph.UnifiedGroupsUtility.AddUnifiedGroupMembers(group.GroupId, siteCollectionCreationInformation.Owners, graphAccessToken); // Try to configure the site/group classification, if any if (!string.IsNullOrEmpty(siteCollectionCreationInformation.Classification)) { From 04ea70d4072ad75741f6efce871cb3eb6f7c38a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Angel=20Garc=C3=ADa=20Mart=C3=ADnez?= Date: Tue, 25 Oct 2022 12:47:25 +0200 Subject: [PATCH 5/5] revert changes --- src/lib/PnP.Framework/Sites/SiteCollection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/PnP.Framework/Sites/SiteCollection.cs b/src/lib/PnP.Framework/Sites/SiteCollection.cs index 74ba34b2f..ab3b89434 100644 --- a/src/lib/PnP.Framework/Sites/SiteCollection.cs +++ b/src/lib/PnP.Framework/Sites/SiteCollection.cs @@ -539,7 +539,7 @@ public static async Task CreateTeamSiteViaGraphAsync(ClientContex if (group != null && !string.IsNullOrEmpty(group.SiteUrl)) { - Graph.UnifiedGroupsUtility.AddUnifiedGroupMembers(group.GroupId, siteCollectionCreationInformation.Owners, graphAccessToken); + Graph.UnifiedGroupsUtility.AddUnifiedGroupMembers(group.GroupId, siteCollectionCreationInformation.Owners, graphAccessToken); // Try to configure the site/group classification, if any if (!string.IsNullOrEmpty(siteCollectionCreationInformation.Classification)) {