cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Using flow to analyse document file names and apply term store metadata

I have an O365 platform, and in one of the site collections I have a document library with files that are uploaded using a standard naming convention: <Business Unit>_<ITIL Practice>_<Document Type>_<Document Description>. Examples below:

ITSM_KM_POLICY_KnowledgeManagementPolicy.docx
ITSM_CM_PROCESS_ChangeManagementProcessTemplate.pdf
ITSM_AM_PROCESS_ManagingOrganizationalAssets.pdf
ITSM_KM_GOV_KnowledgeManagementGovernanceFramework.pdf

The library has 3 managed metadata columns:

1) Business Unit
2) ITIL Process
3) Document Type

I also have a managed term store, with the following hierarchy:

Branch 1
Parent term 1: Business Unit
Child terms 1: ITSM, ITSB, ITSA

Branch 2
Parent term 2: ITIL Practice
Child terms 2: KM, CM, AM, EM

Branch 3
Parent term 3: Document Type
Child terms 3: Policy, Process, Gov, Training

I would like to set up a flow that runs whenever a file is added or modified in the library, and which compares each part of the filename with the relevant term store branch, and where it finds a match, to apply the matched term store value in the correct metadata column. Where it doesn't find a match, it leaves the value blank.

 

Any help would really be appreciated. Let me know if you need more information.

2 ACCEPTED SOLUTIONS

Accepted Solutions
v-zhos-msft
Solution Sage
Solution Sage

Hi @Anonymous ,

Where does the data of (Business Unit ,ITIL Process ,Document Type) stored, in SharePoint list or excel file?

I set the data via Compse action by myself on my side.

Then I have made a flow for your scenario, please check it for a reference.

The expression in the Compose is :

split(triggerBody()?['{FilenameWithExtension}'],'_')
The setting of Condition1~Condition3 are similar.
The expression in the Condition 1 is : outputs('Compose')?[0]
The expression in the Condition 2 is : outputs('Compose')?[1]
The expression in the Condition 3 is : outputs('Compose')?[2]

Capture7.PNGCapture8.PNGCapture9.PNG

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @Anonymous ,

Could you please share a screenshot of the data in your SharePoint term store.

I am afraid there is no way to get the data (Business Unit ,ITIL Process ,Document Type)from SharePoint term store via flow currently.

1 Add the data (Business Unit ,ITIL Process ,Document Type) in an array.

2 Split the file name.

3 Check whether the file name in the array.

4 Update the file metadata.

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
v-zhos-msft
Solution Sage
Solution Sage

Hi @Anonymous ,

Where does the data of (Business Unit ,ITIL Process ,Document Type) stored, in SharePoint list or excel file?

I set the data via Compse action by myself on my side.

Then I have made a flow for your scenario, please check it for a reference.

The expression in the Compose is :

split(triggerBody()?['{FilenameWithExtension}'],'_')
The setting of Condition1~Condition3 are similar.
The expression in the Condition 1 is : outputs('Compose')?[0]
The expression in the Condition 2 is : outputs('Compose')?[1]
The expression in the Condition 3 is : outputs('Compose')?[2]

Capture7.PNGCapture8.PNGCapture9.PNG

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thanks @v-zhos-msft, the logic of your flow makes sense to me and is actually super useful. However, the data of (Business Unit ,ITIL Process ,Document Type) is stored, not in a SharePoint list or excel file or hard-coded into the flow, but in the SharePoint term store. So I presume we'd need some sort of comparison clause here so that the flow:

1) Breaks down the file names into outputs
2) Searches the term store for matches to those outputs (or maybe just searches a parent term and all children, if searching over a whole term store isn't advisable)
3) When it finds a match, applies the term store value to the file properties (rather than applying a term locally\just in text form in the file properties, which would mean that we can't take advantage of SP's platform-wide reach when it comes to term stores to do things like sset up search refiners for terms when doing platform-wide searches).
4) When it doesn't find a match, leaving the column entry blank

Hi @Anonymous ,

Could you please share a screenshot of the data in your SharePoint term store.

I am afraid there is no way to get the data (Business Unit ,ITIL Process ,Document Type)from SharePoint term store via flow currently.

1 Add the data (Business Unit ,ITIL Process ,Document Type) in an array.

2 Split the file name.

3 Check whether the file name in the array.

4 Update the file metadata.

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Thanks @v-zhos-msft, much appreciated 🙂

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (1,155)