Articles in this section

How to set Custom XML Value, Managed Metadata, and DateTime Value in the metadata of a template

About this article

This article will explain what the Custom XML Value, Managed Metadata, and DateTime Value are and provide examples of how they can be utilized with the binding syntax in smart templates.  

 

Prerequisites

 

 

What are Custom XML Value, Managed Metadata, and DateTime Value properties? 

Custom XML Value, Managed Metadata, and DateTime Value are data that sit on top of the document, they are also known as metadata. Custom XML Value, Managed Metadata, and DateTime Value are often used for archiving purposes in Document Management Systems (DMS) such as SharePoint. These values can be set statically using plain text or dynamically using the binding syntax

  • Custom XML Value: should always be used, unless the column in SharePoint is of type "Managed Metadata" (term sets) or "Date and Time".
  • Custom XML Managed Metadata: should be used only when the column in SharePoint is of type "Managed Metadata" (term sets).
  • Custom XML DateTime Value:  should be used only when the column in SharePoint is of type "Date and Time".

 

 

 

How to set a Custom XML Value, Managed Metadata, and DateTime Value in a smart template

When building the template settings and properties, the Custom XML Value / Managed Metadata / DateTime Valuecan be utilized to set the metadata for the smart template. Setting the properties can be achieved by following these steps: 

  1. In the Template Designer, navigate to the Advanced tab
  2. Click Add property 
  3. Select Custom XML Value / Managed Metadata / DateTime Value in the Type dropdown
    1. Custom XML Value set the Binding, the Namespace, and the Path
    2. Managed Metadata set the Namespace, the Path, the Term Id, and the Term Name
    3. DateTime Value set the the Binding, the Namespace, and the Path
  4. Optionally, set an additional option to the property
  5. Click Add to document
    • The Custom XML Value / Managed Metadata / DateTime Value will be added to the smart template 

 

 

 

Custom XML Value example

Configure a Word template and save the metadata to SharePoint.

 

  1. Create a document in SharePoint (or upload a document):

    customxmlvalue_newdocument.png

  2. Close the document.
  3. Select the saved document and open the details pane. Add random values to all columns you would like to use. Do not leave them blank:

    customxmlvalue_sharepointproperties.png

 

 
  • If you leave a field blank (like "Category" in the image above), then SharePoint will attach a  "@nil" value to it. As a result, Templafy can't attach the Custom XML Value to the field and no metadata is saved to SharePoint.
  1. Download and open the document in Word
  2. Open the Template Designer and click Create Template to activate Dynamics and document content updater on the document
  3. Navigate to the Form tab and create the following text questions: "Title", "OrderID", "Description" and "Category"

    Questions_custom_XML.png

 

 
  • In this example, text questions are used, but other question types like date and dropdown are also supported.
  • If the SharePoint column is a "Choice field" (dropdown or radio buttons), please ensure that the dropdown list items in Templafy are written exactly the same way as in SharePoint (the list items are case sensitive).
  1. Navigate to the Advanced tab, click Add property, and select Custom XML Value 
  2. On the Developer tab select XML Mapping Pane. In the field Custom XML Part select http://schemas.microsoft.com/office/2006/metadata/properties.
    When you select this namespace, an element named properties with a child element named documentManagement appears. Expand documentManagement to show all available fields (column names) from SharePoint:

    xmlmappingpane.png

 

 
  • The name of an element should not be expandable. If it is expandable then it will show the "@nil" value mentioned before.

 

Note that the column Order ID from SharePoint is shown as Custom XML Part Order_x0020_ ID. The name Order ID is the display name in SharePoint, while Order_x0020_ IDis the internal name (this name will be used for the template). In SharePoint, the internal name can be retrieved by opening the properties of a column. The URL will show the internal name:

customxmlvalue_internalname.png

  1. Enter the required values in the Custom XML Value started in step 7
    • Namespace: http://schemas.microsoft.com/office/2006/metadata/properties
    • Path/p:properties/documentManagement/*[local-name()="<field>"], where <field> is the name of the field that needs to be used. 
    • Binding: enter the required binding syntax to utilize the correct question created in step 6, in this case {{Form.OrderId}} 

customxmlorderid.png

 

 

 
  • Values in the fields above are case-sensitive
  • *[local-name()="<field>"] should be used on every level, or only where a namespace is specified (explanation about namespaces is beyond this help topic). If this notation doesn't provide the expected result, please only use the field name instead, in this example that would be: /p:properties/documentManagement/Order_x0020_ID
  • In the Binding field, plain text can also be utilized to set the metadata statically.  
  1. The result should loos like this:

    custom_xml_values.png


    Additionally, the "Title" of the document should also be saved in SharePoint. This can be achieved by utilizing Document Property
  1. Navigate to the Advanced tab, click Add property, select Document Property, and enter the desired values

    customxmltitle.png
  1. Save your template, and upload it to Templafy
  2. Create the document as an end-user and fill in the 4 questions: 

    customxmlvalue_composer.png

  3. Save the document to SharePoint. The metadata is shown in the columns and the details pane.

    customxmlvalue_sharepointresult.png

 

 
  • Note that no metadata is written to the column "Category" as it was left blank in step 3. SharePoint attached a "@nil" value. Please make sure to always fill all columns.

 

Managed Metadata example

A special column of type Managed Metadata can be created in SharePoint. It enables users to select terms from a specific term set. If this column should be used in your template, please follow the below steps.

 

In this example, the template utilized in the example above is expanded with an additional custom XML that saves the value to a managed metadata column in SharePoint.

 
  • For managed metadata, Custom XML Managed Metadata ) should be used.

 

  1. In SharePoint create a new column (in this example Snacks and select Managed Metadata as the type of information. To do this, navigate to the SharePoint homepage -> Select the desired site, for example "Communication site". Then "Site Settings" -> Then "Site Columns" -> Create
    mceclip0.png
    mceclip1.pngmceclip3.pngmceclip4.png
 
  • The option Allow multiple values is not supported in Templafy.

mceclip5.png

  1. In the section Term Set Setting a managed term set can be used or a new term set can be created. The latter will be utilized in this example. 

    customxmlvalue_customizetermset.png
  1. The result looks like this:

    customxmlvalue_termset.png
  1. Templafy will require the Unique Identifier  for each term created in the previous step. Go to the Site Settings page and open Term store management:


    mceclip6.png
    If you do not see the below window or it looks different, you are in the "Modern" view, click "Return to classic" in the top right window if you wish to follow along in this guide.
  1. In the Term Store Management Tool, select a term to display the Unique Identifier

    customxmlvalue_uniqueidentifier.png

 

 
  • The terms and unique identifiers can also be found in Windows Explorer (after saving a document, created from Word, to SharePoint in the library containing a managed metadata column). Navigate to C:\Users\<username>\AppData\Local\Microsoft\Office\TermSets. This folder contains files like "abc1d2ed-3456-7898-7cba654321.xml". Find the correct file (in general a file created today) and open it in Notepad.

  1. In the Admin Center, create a data source containing all terms along with their corresponding unique identifiers. 

    customxmlvalue_datasource.png
  1. Download the template that was uploaded to the Library in step 12 of the example above. Open the file and the Template designer, and create a new dropdown question linking to the above data source.

    dropdown_snack.png
  1. Save the template.
 
  • The new column created in SharePoint needs to be added as Custom XML part to the template. To do this, the template must be uploaded to SharePoint, to the library containing the new column.
  1. Upload the template to the correct SharePoint library containing the new column
  2. In SharePoint select the saved template and open the details pane. Add a random value to the new field Snacks (and to all other columns that should be use):

    customxmlvalue_sharepointmetadata.png
  1. Download the template and open it.
  2. On the Developer tab select XML Mapping Pane. In the field Custom XML Part select http://schemas.microsoft.com/office/2006/metadata/properties. All available fields (column names) from SharePoint created earlier will be displayed, and a new field named (in this example) "k48e728b471d4ab68c80ce6895fa8dd5" with child elements named Terms, TermInfo, TermName, and TermId. In the XML Mapping pane managed metadata fields are not shown with their display name, but with their unique identifier. The identifier shown in this example represents the field (column) 'Snacks' that was created:

    customxmlvalue_xmlmapping.png

 

 
  • In case of a doubt that the identifier represents the field (column) that should be used, the below steps can be followed: rename the extension of the downloaded template to .zip. In the zip file, navigate to the 'CustomXML' folder. This folder contains one or more XML files named 'itemX.xml'. Open the one that looks similar to the example below. The identifier for each TermName (here "Hamburger") be displayed in the main tag highlighted in red. 

    customxmlvalue_xmlfile.png

  1. Navigate to the Advanced tab, click Add property, and select Custom XML Managed Metadata 
  2. Enter the required values in the Custom XML Value started in step 7
    • Namespace: http://schemas.microsoft.com/office/2006/metadata/properties
    • Path: /p:properties/documentManagement/*[local-name()="<field>"],
      where <field> is the name of the field that needs to be used. In this example: /p:properties/documentManagement/*[local-name()="k48e728b471d4ab68c80ce6895fa8dd5"]
    • Term Id: enter the required binding syntax to utilize the correct question created in step 6, in this case {{Form.Snack.UniqueIdentifier}} 
    • Term Name: enter the required binding syntax to utilize the correct question created in step 6, in this case {{Form.Snack.Name}} 
 
  • In Path the unique identifier should be used, not the display name.
  1. Save your template, and upload it to Templafy
  2. Create the document as an end-user and fill in the 5 questions:

    customxmlvalue_composerdropdown.png
  1. Save the document to SharePoint. The (managed) metadata is shown in the columns and the details pane. The result will look like this:

    customxmlvalue_sharepointresults.png

 

DateTime Value Example

A column of type Date and Time can be created in SharePoint. It enables users to select a date from a calendar. If you want to use this column in your template then you need to follow the steps below.

 

In this example, the template utilized in the example above is expanded with an additional custom XML that saves the value to a date and time column in SharePoint

 
  • For date fields, Custom XML DateTime Value should be used.

 

  1. In SharePoint create a new column (in this example Date) and select Date and Time as the type of information:

    customxmlvalue_datetime.png
  1. Download the template that was uploaded to the Library in step 15 of the example above. Open the file and the Template designer, and create a new date question (e.g. "Date").

    date_question.png

    Save the template.
 
  • The new column created in SharePoint needs to be added as Custom XML part to the template. To do this, you need to upload the template to SharePoint, to the library where you have created the new column.
  1. Upload the template to the correct SharePoint library containing the new column
  2. In SharePoint select the saved template and open the details pane. Then add a random value to the new field Date (select any date from the calendar).
  3. Download the template and open it.
  4. On the Developer tab select XML Mapping Pane. In the field Custom XML Part select http://schemas.microsoft.com/office/2006/metadata/properties. All available fields (column names) from SharePoint created earlier will be displayed, and a new field named (in this example) Date
  5. Navigate to the Advanced tab, click Add property, and select Custom XML DateTime Value 
  6. Enter the required values in the Custom XML Value started in step 7
    • Namespace: http://schemas.microsoft.com/office/2006/metadata/properties
    • Path: /p:properties/documentManagement/*[local-name()="<field>"], where <field> is the name of the field that needs to be used. In this example /p:properties/documentManagement/*[local-name()="Date"]
    • Binding: enter the required binding syntax to utilize the correct question created in step 6, in this case {{Form.Date}}
  7. Save your template, and upload it to Templafy
  8. Create the document as an end-user and fill in the 6 questions:
  9. Save the document to SharePoint. The date is shown in the column and the details pane. The result looks like this:

    customxmlvalue_sharepointresult__1_.png

 

Dynamics metadata in PowerPoint

Despite that PowerPoint does not have an XML Mapping Pane, you can configure Dynamics metadata in PowerPoint with Templafy (this basically works the same way as in Word).

To find the namespace of the xml you can follow these steps (example with SharePoint):

  1. Create a PowerPoint template (you don't have to create form fields etc.).

  2. Upload the template to SharePoint.

  3. Download the template from SharePoint.

  4. Rename the extension .pptx to .zip.

  5. Unpack the zip file.

  6. In the unpacked folder open the 'customXml' folder:

    customxmlvalue_unpackedfolder.png

  7. This folder contains 1 or more 'itemX.xml' files:

    customxmlvalue_xmlitems.png

  8. Open each file until you find one that has content that looks like this:

    customxmlvalue_namespace.png

  9. The namespace is marked green in the image above.

 

 

Related articles

 

 

metadata sharepoint custom xml custom xml value managed metadata term set custom xml managed metadata datetime value custom xml datetime value datetime quick parts
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.