How to update folder names
In Solution Studio Modern Forms (version 1.2.1.0) and skybow Modern Forms add-in (version 1.3.0.0) we have added an option to set relationship between dossier and sublibrary by lookup and specify custom folder name.
To run migration for existing libraries you need to change option Set relationship by from 'Folder format' to 'Lookup field' in Library configuration panel on Modern forms, select Lookup field to parent list, Initial folder name format and click Ok button in the panel. Migration process will start after you confirm this in 'Items relationship migration' dialog.
Note: During migration we will not update name of existing folders and do not set lookup value for file. This migration will set lookup to main folder only. To set lookup to child files you need to run set_lookupvalue_childitems.ps1 script.
If you would like to change existing folder names on sublibrary you need to run update_folder_names.ps1 script via PowerShell.
In this block of code from script you can specify dossier sublibrary folder name format:
function New-Folder-Name( [Microsoft.SharePoint.Client.ListItem]$mainItem, [Microsoft.SharePoint.Client.ListItem]$folder ){
$newFolderName = $mainItem["Title"] + "-" + $mainItem.Id
#Replaces special symbols that are not allowed to be used in folder name
$newFolderName = $newFolderName -replace '[:*"?|%#<>\\/]|^~|(_vti_)|^(?:aux|con|clock\$|nul|prn|com[1-9]|lpt[1-9]|forms)$/gi', '_'
return $newFolderName
}
How to set lookup value for child items
Script set_lookupvalue_childitems.ps1 allows you to set main folder lookup value to the child files recursively.
Note: In order to run scripts for SharePoint 2019 OnPremise set $SharePointVersion = "2019"
Comments
1 comment
How to easily get Dossier's related subfolder name
In Actions where you have to specify a foldername/path (e.g. Document Generator Output, Copy/Move Document etc.) which you had earlier defined the sub folder as static folder name like this: MainlistName-[[ID]]
You can use this Expression to get the name of the Dossier related folder (since the folder name is not static anymore):
just replace SublibraryName and LookupToMainList with your list and column name
Article is closed for comments.