Auto-tagging files in SharePoint with AI and Flow

Today I want to show you how simple is to add auto-tagging functionality to your existing SharePoint Library with no code.

So, idea is that we have SharePoint Library in which we want to upload different images. For each image we have Tags field in which we want to recognize (OCR), analyse and append key phrases from images.

For OCR recognition we will use Computer Vision API from Microsoft Cognitive Services. For text analysis we will use Text Analytics API from same service package.

The power is in Microsoft Flow.

So, lets start. Firstly, we have to create SharePoint Document Library.

2018-05-10_1520

Then we add new Column named Tags. It can be optional with Multiple lines of text type.

2018-05-10_1522

After that we create new Flow on this Library. Because there is no corresponding template we have to click on See your flows link.

2018-05-10_1522_001

Create new Flow from blank 

2018-05-10_1523

… and use When an item is created start trigger.

2018-05-10_1524

Remove default trigger step and choose SharePoint – When a file is created in a folder instead.

2018-05-10_1525

Set Site Address to Site Url, where you have already created Images Document Library and set Folder Id to it.

2018-05-10_1526

As next step please use SharePoint – Get file metadata action …

2018-05-10_1527

… and set Site Address and File Identifier as follow:

2018-05-10_1528

After that you could get file properties with ItemId:

2018-05-10_1529

As I mentioned we will use Computer Vision API and Text Analytics API. You could try trial version of both for 7 days via links above.

Please copy Endpoint and Keys for both APIs because you have to use it in your Flow for API authentication.

2018-05-10_1537

2018-05-10_2112.png

After that you could use next step from Computer Vision API for OCR to text conversion from File Content.

2018-05-10_1540

Then you put detected text into Text Analytics API to get Key Phrases from it.

2018-05-10_2114

From that stap you will get array of Key Phrases, so we have to do Join function on it with “, “ string.

2018-05-10_2127

And the last step – we save Output from Join function into Tags field of our item – we use Update Item SharePoint step.

2018-05-10_2131

Full flow here:

2018-05-10_2155

In my example I have two images uploaded to SharePoint Library. One have English text and another Slovenian.

2018-05-11_0755

In example above we have this two images inside Library:

Cheers!
Gašper Rupnik

{End.}

Advertisements

4 thoughts on “Auto-tagging files in SharePoint with AI and Flow

Add yours

  1. Great article!
    Did you need to setup anything in Azure to get this to work? I’ve just built this but it continues to error on the Join -“‘Required property ‘from’ expects a value but got null.”

  2. @hpurdum sory about my late response -> no, you don’t need to setup anything else inside of your Azure. I think you have I problem with your OCR or Key Phrases steps -> you have to specify APIs endpoints & keys.

  3. Excellent Documentation !!
    I did try the above method and was able to achieve the outcome. Can you please find a solution to auto tag word and text documents on sharepoint ?? It seems it’s a big fuzz.
    Thanks 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: