The Map Folder Name to Field plugin will automatically set a default value of a metadata column based on the name of the SharePoint folder a file is being saved to.
An example of where this can be useful would be if your libraries have a sub folder for each document type (e.g. Memo or Letter) and you would like all files saved to that folder to have their Document Type choice metadata column set automatically as you save to that location.
How it works
Map Folder Name to Field can be configured to set the value of any of the following field types to the name of the folder where a document is being saved.
- Managed Metadata
- Multiple lines of text
- Multi Choice
- Multi Lookup
- Multi Managed Metadata
- Single Line of Text
When a document is saved to SharePoint using DMF or Message, if all the configured conditions are met the default value of the configured columns will be set to match the name of the folder or document set it is being saved to.
The settings that dictate when the Map Folder Name to Field plugin will take affect are specified either under in the registry, or in DMF 8.8.520 or later in a configuration file stored in your central configuration location.
Configuration via the registry
The key to be setup are located under the following registry branch.
Root Registry Settings
The root key “MapFolderNameToFieldValue” has two available settings:
- 0 = Enables the extension (default).
- 1 = Disables the extension.
- 0 = Will only attempt to map and set 1 Field for the targeted Content Type (default).
- 1 = Will attempt to map multiple Fields (if the mapping matches the filter criteria).
The root key also has a subkey named “TargetContentTypes”.
Targeted Content Types Subkey
The TargetContentTypes subkey is a container for each target Content Type the user wishes to use for the Field mappings.
Each Content Type Field map must be in its own subkey. The mapping subkeys can have arbitrary names, however when searching for a matching ContentType->Field map, the search is performed in sequential order. If “EnableMultiple” is disabled (set to 0); the extension will select the first available map that matches. Therefore it’s recommended to name the subkeys in a fashion that represents preferential ordering (i.e. 1, 2, 3 ,4 etc).
Targeted Content Types Registry Settings
Each target Content Type subkey has 14 configurable settings.
Note - If any of the “Allowed” settings are left blank, all Sites, hosts, container types or Lists that are not in the corresponding “Ignore” setting will pass the filtering process.
If an “Allowed” setting is not blank (contains one or more items); only those specified in the “Allowed” setting will pass the filtering process.
A list of allowed container types where the folder name value can be “pulled” from (i.e. Folder, Document Set, Matter Document Set) (default = blank).
A list of allowed servers / hosts, to limit which host the extension will function on (do not include protocol of server;
http or https ) e.g. (contoso.com or localhost:8080) (default = blank).
A list of allowed SharePoint Lists the extension will trigger on (default = blank).
A list of allowed container types for the “Allowed Container”. This setting is used to restrict mapping to subfolders within a folder or document set (i.e. Site->Library->…/…./RootContainer->Container) it is NOT recursive, and will only restrict the parent of the “Allowed Container”.
Format when setting up 2 content types:
A list of SharePoint Webs using the web server relative URL (e.g. /sites/TestSite) (default = blank).
ContentType name for the mapping (i.e. Document, or Matter Document).
Boolean trigger to disable the individual mapping (useful for a temporary disable) (default = 0).
Boolean trigger to enable / disable case sensitive matching (default = 0), set to 1 for ignore case sensitivity.
List of container type to ignore (e.g. Folder, Document Set).
List of hosts / servers to ignore.
List of SharePoint Lists to ignore.
List of Root / Parent container types to ignore (see AllowedRootContainerTypes for more information).
List of SharePoint Webs to ignore (using server relative URL).
Internal Field name of the target ContentType Field to map the folder name value on success.
Note: this value is case sensitive e.g. mvDocumentType
Compulsory Registry Settings
The only compulsory / required Registry settings for each targeted Field map are:
By default Map Folder Name to Field is configured for use with MacroView Case and Matter so that it only applies when saving documents to folders within a Matter Document Set using the Matter Document content type containing a metadata or choice column for Document Type.
Mapping to multiple levels in a nested folder structure
If your folder structure reflects the metadata to be applied to files as they are saved, MapFolderNameToField can be configured to handle this by adding each folder level below the to the MapToFieldInternalName settings separated by backslashes.
For example, in a folder structure like the following, you can map each folder level to a different metadata column.
AllowedRootContainerTypes is required to be blank if you want to save files after the Document Set(Matter) further down the nested folders.
You can also include extra backslashes to indicate additional level without, even if there is no metadata to be set for some of the levels. For the example above, "/" is added the beginning to indicate the document set level without including it in the properties. i.e. /mvDocumentTypeC/Animal/Line1
You can use the above approach to also only set the metadata for particular folder levels. For example setting MapToFieldInternalName to /mvDocumentTypeC//Line1 in the example above would only set the Document Type and Line1 metadata values.
Configuration via a JSON configuration file
MacroView DMF versions 8.8.520 and later support using a configuration file to deploy these settings.
The expected config filename/path is in the MacroView AppData store location “Extensions\MapFolderNameToFieldValue\configuration.json.config”
To deploy the file from the Central Configuration Location create a Folder in your Central Resource library called "MapFolderNameToFieldValue" and save the configuration file to that locaton.
Download a sample configuration file.
The difference between the registry configuration and the JSON configuration file is mostly the filtering format.
In this sample JSON configuration file the AllowedContainerTypes + IgnoredContainerTypes are combined in a dictionary object “ContainerFilters”. Similarly with AllowedRootContainerTypes/IgnoredRootContainerTypes, AllowedLists/IgnoredLists, AllowedSites/IgnoredSites and AllowedHosts/IgnoredHosts.
To add a filter type as “allowed”, the name/key is set as the object property name (e.g., “Document Set”) and the value is set to true (or false for Ignored filter types).
Configuration File Syntax
"Disabled" : false,
"Document Set": false,
"Document Set": true,
Note: If both a configuration file and registry settings are defined the configuration files will override the registry
Important: This plug-in will only function once they are added to your MacroView DMF or Message license. Contact firstname.lastname@example.org to obtain a license for these plug-ins.
If you are running MacroView DMF or Message 8.6.103 or later you do not need to install this plug-in separately as it is already included in the DMF or Message installation and will become active once a license has been obtained. If you already have this extension installed and upgrade to DMF or Message 8.6.103 or later you can uninstall the separate add-in.
Close Microsoft Outlook, DMF Explorer (if applicable) and the MacroView DMF Local Service then download and run the Map Folder Name to Field installer that corresponds with your installation of Windows.
- MacroView DMF or MacroView Message 8.5.1088 or later
If after installing the plug-in is not available refer to how to activate a licensed DMF or Message plug-in.