Defining Metadata for an External File Source
To define automatic metadata for externally created documents:
- Open M-Files Admin.
 - In the left-side tree view, expand a connection to M-Files server.
 - Expand Document Vaults.
 - Expand a vault.
 - Expand Connections to External Sources and click File Sources.
 - 
                On the File Sources list, double-click the file source
                    that you want to edit.
                Result:The Connection Properties dialog is opened.
 - 
                Click Metadata.
                Result:The Metadata tab is opened.
 - 
                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.
 - 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.
 - Use the Property drop-down menu to select the property for which you want to define a value.
 - 
                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:
Now, to use the text inside the<?xml version="1.0" encoding="UTF-8"?> <document> <name>The name of the document</name> <keywords>Keywords in an XML file</keywords> </document>keywordselement in the XML file as the value for the selected property, you would enterdocument/keywordsin the Read from an XML file field, and thus you would get Keywords in an XML file as the property value. The stringdocument/keywordsis a simple XPath expression that selects allkeywordselements that are children of thedocumentelement.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/keywordsor
//*[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)
 
 
 - Use a fixed value: Use this option to specify a
                        fixed property value.
 - 
                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.
 
 - 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.
 - Click OK to close the Define Property dialog.
 - 
                Use the Permissions drop-down menu to set the permissions
                    for new objects created through the external source.
                You can click the button to refine the permission settings.
 - 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)
 
 - Click OK to finish defining the metadata.