I noticed the other day that there is a new trigger available in Power Automate for SharePoint Syntex models. This is used to trigger a flow when a document is added to a library that has a Content/Document understanding model applied to it. The flow can then run a variety of actions in a workflow i.e. use an Outlook action to send an email, call Azure automation to run code in the cloud, use a SharePoint action to copy the file after being classified to another library etc.. This new trigger is SharePoint category and the name of the trigger is When a file is classified by a content understanding model.
Documentation from docs.microsoft.com
Taken from SharePoint – Connectors | Microsoft Docs
When a file is classified by a content understanding model
Triggers when a SharePoint Syntex content understanding model classifies a file, shown in the classification date property of the file.
|Site Address||dataset||True||string||Example: https://contoso.sharepoint.com/sites/sitename|
|Library Name||table||True||string||SharePoint library name|
|Folder||folderPath||string||Select a folder, or leave blank for the whole library|
|Limit Columns by View||view||string||Avoid column threshold issues by only using columns defined in a view|
The outputs of this operation are dynamic.
Testing The Syntex Trigger in Power Automate
I then went to my demo tenant to test this new trigger with Power Automate. I created a new flow and added the new trigger When a file is classified by a content understanding model. I then pointed it to an existing Library that had a content understanding model applied to it and then added some files to the library to trigger the model.
The Flow is then triggered and here is an example of the information returned (general model finformation fields in blue and Model Columns in yellow)
I was hoping there would be ModelName field but this is not the case and only OData__ModelId is supplied. If I want the ModelName I am going to have to connect via the SharePoint Syntex Rest API and use Get model and library info | Microsoft Docs using the ID I just obtained. See image below for how I connected – note connection required to your content center for the Site Address.
The ModelName field is then available in the Output JSON. However it is tricky to extract this as it is buried in an array in the third level of JSON and is not returned dynamically.
To extract the ModelName the expression required is:
I then added an Outlook email action to email an admin every time the model is triggered. All of the fields are easily added to the email action through the UI except ModelName which needs the expression above.
The completed Flow in Power Automate
This new trigger assists with some great possible automation/reporting with SharePoint Syntex Content/Document understanding models and when new files are added. Think this will be used with Roadmap Item 88709 to add to the Power Automate built in template library a flow template to send a customised email after file classification.
The output from the trigger could be improved by returning more details about the Model i.e. ModelName so further SharePoint Syntex REST Api calls do not need to be made. It would also be good to have a Processing status when the trigger is triggered but the document does not match the classifier of a model. The trigger still runs for every file added to the library but not necessarily every file is associated with a model.
This is a welcome update and looking forward to many more Syntex triggers and actions in Power Automate being added. Although if an action is not available I have also showed using the SharePoint Syntex Document Understanding REST API how you can call the Syntex API using the SharePoint Send HTTP action in Power Automate.