diff --git a/src/lib/PnP.Framework/Provisioning/ObjectHandlers/ObjectListInstanceDataRows.cs b/src/lib/PnP.Framework/Provisioning/ObjectHandlers/ObjectListInstanceDataRows.cs index 003fc8095..8c3a699d4 100644 --- a/src/lib/PnP.Framework/Provisioning/ObjectHandlers/ObjectListInstanceDataRows.cs +++ b/src/lib/PnP.Framework/Provisioning/ObjectHandlers/ObjectListInstanceDataRows.cs @@ -399,6 +399,8 @@ private ProvisioningTemplate ProcessLibraryItems(Web web, string defaultContentTypeId) { var itemCount = 1; + var listDefaultColumnValues = siteList.GetDefaultColumnValues(); + foreach (var item in items) { switch (item.FileSystemObjectType) @@ -412,7 +414,7 @@ private ProvisioningTemplate ProcessLibraryItems(Web web, case FileSystemObjectType.Folder: { //PnP:Folder - ProcessFolderRow(web, item, siteList, listInstance, queryConfig, template, scope); + ProcessFolderRow(web, item, siteList, listInstance, queryConfig, listDefaultColumnValues, template, scope); break; } default: @@ -705,7 +707,7 @@ private string TokenizeValue(Web web, string fieldTypeAsString, KeyValuePair> listDefaultValues, string serverRelativePathToFolder, PnPMonitoredScope scope, Model.Configuration.Lists.Lists.ExtractListsQueryConfiguration queryConfig) { Model.Folder pnpFolder = null; try @@ -806,6 +808,19 @@ public Model.Folder ExtractFolderSettings(Web web, List siteList, string serverR } } } + + //export PnPFolder default values + if (listDefaultValues != null) + { + var href = Uri.UnescapeDataString(spFolder.ServerRelativeUrl); + href = href.Replace(siteList.RootFolder.ServerRelativeUrl, "/").Replace("//", "/"); + + var defaultValues = listDefaultValues.Where(dv => dv["Path"] == href); + foreach (var defaultValue in defaultValues) + { + pnpFolder.DefaultColumnValues.Add(defaultValue["Field"], defaultValue["Value"]); + } + } } catch (Exception ex) { @@ -814,7 +829,7 @@ public Model.Folder ExtractFolderSettings(Web web, List siteList, string serverR return pnpFolder; } - private void ProcessFolderRow(Web web, ListItem listItem, List siteList, ListInstance listInstance, Model.Configuration.Lists.Lists.ExtractListsQueryConfiguration queryConfig, ProvisioningTemplate template, PnPMonitoredScope scope) + private void ProcessFolderRow(Web web, ListItem listItem, List siteList, ListInstance listInstance, Model.Configuration.Lists.Lists.ExtractListsQueryConfiguration queryConfig, List> listDefaultValues, ProvisioningTemplate template, PnPMonitoredScope scope) { listItem.EnsureProperties(it => it.ParentList.RootFolder.ServerRelativeUrl); string serverRelativeListUrl = listItem.ParentList.RootFolder.ServerRelativeUrl; @@ -833,7 +848,7 @@ private void ProcessFolderRow(Web web, ListItem listItem, List siteList, ListIns if (pnpFolder == null) { string pathToCurrentFolder = string.Format("{0}/{1}", serverRelativeListUrl, string.Join("/", folderSegments.Take(i + 1))); - pnpFolder = ExtractFolderSettings(web, siteList, pathToCurrentFolder, scope, queryConfig); + pnpFolder = ExtractFolderSettings(web, siteList, listDefaultValues, pathToCurrentFolder, scope, queryConfig); listInstance.Folders.Add(pnpFolder); } } @@ -843,7 +858,7 @@ private void ProcessFolderRow(Web web, ListItem listItem, List siteList, ListIns if (childFolder == null) { string pathToCurrentFolder = string.Format("{0}/{1}", serverRelativeListUrl, string.Join("/", folderSegments.Take(i + 1))); - childFolder = ExtractFolderSettings(web, siteList, pathToCurrentFolder, scope, queryConfig); + childFolder = ExtractFolderSettings(web, siteList, listDefaultValues, pathToCurrentFolder, scope, queryConfig); pnpFolder.Folders.Add(childFolder); } pnpFolder = childFolder;