diff --git a/Core/OfficeDevPnP.Core/Framework/Provisioning/ObjectHandlers/ObjectListInstance.cs b/Core/OfficeDevPnP.Core/Framework/Provisioning/ObjectHandlers/ObjectListInstance.cs index 43f3c5a078..a771696a70 100644 --- a/Core/OfficeDevPnP.Core/Framework/Provisioning/ObjectHandlers/ObjectListInstance.cs +++ b/Core/OfficeDevPnP.Core/Framework/Provisioning/ObjectHandlers/ObjectListInstance.cs @@ -193,6 +193,21 @@ public override TokenParser ProvisionObjects(Web web, ProvisioningTemplate templ #endregion Views + #region Column default values + + foreach (var listInfo in processedLists) + { + var defaultFolderValues = new List(); + foreach (var templateListFolder in listInfo.TemplateList.Folders) + { + var folderName = templateListFolder.Name; + ProcessDefaultFolders(web, listInfo, templateListFolder, folderName, defaultFolderValues, parser); + } + listInfo.SiteList.SetDefaultColumnValues(defaultFolderValues, true); + } + + #endregion Column default values + #region Folders // Folders are supported for document libraries and generic lists only @@ -230,21 +245,6 @@ public override TokenParser ProvisionObjects(Web web, ProvisioningTemplate templ } #endregion Property Bag Entries - - #region Column default values - - foreach (var listInfo in processedLists) - { - var defaultFolderValues = new List(); - foreach (var templateListFolder in listInfo.TemplateList.Folders) - { - var folderName = templateListFolder.Name; - ProcessDefaultFolders(web, listInfo, templateListFolder, folderName, defaultFolderValues); - } - listInfo.SiteList.SetDefaultColumnValues(defaultFolderValues, true); - } - - #endregion Column default values } WriteMessage("Done processing lists", ProvisioningMessageType.Completed); } @@ -253,20 +253,20 @@ public override TokenParser ProvisionObjects(Web web, ProvisioningTemplate templ } private static void ProcessDefaultFolders(Web web, ListInfo listInfo, Model.Folder templateListFolder, string folderName, - List defaultFolderValues) + List defaultFolderValues, TokenParser parser) { foreach (KeyValuePair columnValue in templateListFolder.DefaultColumnValues) { - string fieldName = columnValue.Key; + string fieldName = parser.ParseString(columnValue.Key); var field = listInfo.SiteList.Fields.GetByInternalNameOrTitle(fieldName); var defaultValue = - field.GetDefaultColumnValueFromField((ClientContext)web.Context, folderName, new[] { columnValue.Value }); + field.GetDefaultColumnValueFromField((ClientContext)web.Context, folderName, new[] { parser.ParseString(columnValue.Value) }); defaultFolderValues.Add(defaultValue); } foreach (var folder in templateListFolder.Folders) { var childFolderName = folderName + "/" + folder.Name; - ProcessDefaultFolders(web, listInfo, folder, childFolderName, defaultFolderValues); + ProcessDefaultFolders(web, listInfo, folder, childFolderName, defaultFolderValues, parser); } } @@ -2205,7 +2205,7 @@ private void CreateFolderInList(ListInfo list, Microsoft.SharePoint.Client.Folde parentFolder.Context.ExecuteQueryRetry(); foreach (var p in folder.Properties.Where(p => !p.Key.Equals("ContentTypeId"))) { - currentFolderItem[p.Key] = parser.ParseString(p.Value); + currentFolderItem[parser.ParseString(p.Key)] = parser.ParseString(p.Value); } #if !SP2013 && !SP2016 currentFolderItem.UpdateOverwriteVersion(); @@ -2230,7 +2230,7 @@ private void CreateFolderInList(ListInfo list, Microsoft.SharePoint.Client.Folde { foreach (var p in folder.PropertyBagEntries) { - currentFolder.Properties[p.Key] = parser.ParseString(p.Value); + currentFolder.Properties[parser.ParseString(p.Key)] = parser.ParseString(p.Value); } currentFolder.Update(); }