Defining Metadata for an External File Source

Note: This content is no longer updated. For the latest content, please go to the user guide for M-Files Online. For information on the supported product versions, refer to our lifecycle policy.

To define automatic metadata for externally created documents:

  1. Open M-Files Admin.
  2. In the left-side tree view, expand a connection to M-Files server.
  3. Expand Document Vaults.
  4. Expand a vault.
  5. Expand Connections to External Sources and click File Sources.
  6. On the File Sources list, double-click the file source that you want to edit.
    Result:The Connection Properties dialog is opened.
  7. Click Metadata.
    Result:The Metadata tab is opened.
  8. In Object type, select the object type that the external objects get when they are imported or linked to M-Files.
    The selected object type must have the Objects of this type can have files setting enabled.
  9. Click Add... to define a new property and value to be added automatically for objects created from external files, or select one of the existing properties and click Edit... to edit it.
    Result:The Define Property dialog is opened.
  10. Use the Property drop-down menu to select the property for which you want to define a value.
  11. In the Define Property dialog, select one of the following options:
    • Use a fixed value: Use this option to specify a fixed property value.
      or
    • Read from an XML file produced by HP DSS: Use this option if you want to obtain a property value from user-provided metadata when a document is scanned and OCRed using HP DSS.
      or
    • Read from an XML file: Use this option to read a property value from an XML file using an XPath expression. The name of the XML file must match the name of the file to be imported. For instance, when the name of the file is filename.txt the XML file must be named filename.xml.
      For example, say you have the following XML file:
      <?xml version="1.0" encoding="UTF-8"?>
      <document>
          <name>The name of the document</name>
          <keywords>Keywords in an XML file</keywords>
      </document>
      Now, to use the text inside the keywords element in the XML file as the value for the selected property, you would enter document/keywords in the Read from an XML file field, and thus you would get Keywords in an XML file as the property value. The string document/keywords is a simple XPath expression that selects all keywords elements that are children of the document element.

      XPath is a W3C standard syntax for defining locations in an XML document. For detailed information on XPath syntax, see the W3Schools XPath Tutorial.

      Note: If the XML file uses namespaces, you need to take them into account in the XPath expression. You can use the namespace prefixes in the expression. Note that the default namespace, however, has no prefix. Selecting from the default namespace is possible, for instance, by using the namespace-uri() or the local-name() XPath function, or both, in the expression. Multiple namespaces with the same prefix are not supported.

      For example:

      mynamespace:document/keywords

      or

      //*[namespace-uri()='http://www.exampleuri.com' and local-name()='document']/[namespace-uri()='http://www.exampleuri.com' and local-name()='keywords']

      or
    • Use an OCR value source: Click Define... to define a zone in a scanned document from which to capture the property value. For detailed instructions, see Defining an OCR Value Source.
      or
    • Read from the properties of the imported file: Use this option to populate the property value with a Microsoft Windows file property value. Use the File property drop-down menu to select the appropriate file property. The accepted data types for the file properties are as follows:
      • Name: Text, Text (multi-line)
      • Directory: Text, Text (multi-line)
      • Extension: Text, Text (multi-line), Choose from list
      • Created at: Timestamp
      • Last modified: Timestamp
      • Last accessed: Timestamp
      • Read-only: Boolean (yes/no)
      • Hidden: Boolean (yes/no)
      • Archive: Boolean (yes/no)
  12. If the selected property is of the Choose from list data type, and you chose Read from an XML file produced by HP DSS, Read from an XML file or Use an OCR value source in the previous step, in the Conversion to value list item section, select either:
    • Use the value read as the ID of the item: Select this option if you want to use the captured value as an identifier of the value list item with a separately defined name.
      or
    • Use the value read as the name of the item: Select this option if you want to use the captured value as the name of the value list item. You can check the Add a new item to the list if a matching item is not found check box if you want to add a new value list item whenever a new value is captured.
  13. Click OK to close the Define Property dialog.
  14. Use the Permissions drop-down menu to set the permissions for new objects created via the external source.
    You can click the ... button to refine the permission settings.
  15. Optional: Check the Read values from an XML file check box if you want property values to be read from an XML file. Check also the Delete the XML file after use check box if you want the XML file to be deleted after the metadata has been read.
    The name of the XML file must match the name of the file to be imported. For instance, when the name of the file is filename.txt the XML file must be named filename.xml. The supported XML formats are:
    • Regular XML data
    • XML data output by HP Digital Sending Software (DSS)
  16. Click OK to finish defining the metadata.
The metadata that you have just specified is assigned to any new object created via this external source.