Repository navigation
Field value expressions
Whenever the service uses fields in a configuration file, they may contain simple values (text/numeric/boolean) or Python expressions. The expressions provide a powerful and flexible way of computing values.
Example of exchangeSettings.json:
{
...
"accounts": [
{
"userName": "username",
"userAddress": "username@company.com",
"syncFolders": [
{
"path": "Inbox/SharePoint",
"fields": {
"Partner": "= doc.FolderPath[2]"
}
}
]
}
]
}This example sets the value of the Partner field to the third fragment of the folder path.
Expression are JSON string values formatted as follows:
"<field-name>": "= <expression>"
Note the equal sign (=) following the quotation mark - this is the indication that an expression follows. Make sure you provide valid Python expressions, otherwise run time exceptions will occur and most probably the documents involved will not be uploaded.
- If you need the equal sign as such, not indicating an expression, prefix it with a single quotation mark, like this:
"<field-name>": "'= this is no expression" - If you need the single quotation mark sign as such, not escaping an equal sign, double it, like this:
"<field-name>": "''= we have here only a single quotation mark"
-
doc: this is the document data being uploaded. It contains:
- folderPath: an array of path fragments.
- folder: the path as a string, with the fragments separated by slash (/).
- name: the document name.
- originalName: the original name of the document.
- keywords: an array of keywords extracted from the mail sender domains and path fragments.
- library: the name of the document library where the document should be uploaded.
- fields: a dictionary of document fields.
Note: Array indexes start with 0. This means that
doc.folderPath[0]is the first item in thefolderPatharray.