Related Blogs
The rise of Artificial Intelligence has transformed all the industry with its superficial knowledge and the ability to add human intelligence in machines. The AI- based systems are trying to eliminate the unessential intervention of humans to a greater extent by offering AI-enabled business services. Every business has made a swift application that promises to deliver smart and efficient outputs through AI-enhanced systems in comparison to what humans produce. Using these smart AI-enabled systems, businesses are capable of providing decisions with precision.
To serve businesses better, Microsoft has introduced AI-enabled services called “Cognitive services” which includes various services and sectors categorized according to Vision APIs, Speech APIs, Language APIs, and Search APIs which belong to Cognitive Services. These services can be easily integrated with many other platforms to deliver maximum output.
Thus, we can integrate the above services with Microsoft Flow as it is a successor of SharePoint designer services that prepares AI-Integrated Microsoft Flows which can perform smart jobs with perfection. Well, holistically speaking
Microsoft FLOW + Cognitive Services = Surprisingly Powerful tools
If you are a SharePoint developer and want to learn about Microsoft Flow, let’s dive into it in more detail.
Generate Cognitive Service API Key and URL
To generate a Cognitive Service API Key and URL follow the following steps given below
- Login into an Microsoft Azure account. This will show a list of services if one has already added in it.
- Find the required service from the list and then click Add. For Example: “Text Analysis”. So click on “Text Analysis” and add service in the list
- The selected service will be added in the list of APIs.
- Note down any one value from the Endpoints and a key value either Key 1 or Key 2. These two noted values will be used in the later stage
Cognitive Service Examples
Let’s go through 3 different Cognitive services by using Microsoft Flow. These services are successfully integrated within the Microsoft Flow.
- Text Analytics: This will detect the sentiments of a given sentence like it is positive, negative or neutral.
- Optical Character Recognition to Text: OCR recognition tool will extract text from the uploaded image.
- Recognize Domain Specific Content: This will display the name of the celebrity who is renowned and popular from an uploaded picture if any.
Text Analytics
Flow requirement
Whenever any new feedback is added, the owner of the application must receive an email indicating the added feedback whether it is positive, negative or neutral. Let’s assume, there is a list of user feedback as shown below.
- From the app launcher icon of the Office 365 portal, click on Flow. This will redirect to My Flows page.
- Click + New > + Create from blank.
- Click on Create from blank.
- From the Triggers panel, find and select When an item is created.
- Set values, Site Address = Site collection URL and List Name = Name of the list.
- From the Action panel, find and select Detect Sentiment of Text Analytics API. Enter values:
- Connection Name = Any name here
- Account Key = Enter key value noted while adding this Service API i.e. either Key 1 or Key 2.
- Site URL = Enter endpoint value noted while adding this Service API.
Then click “Create”.
- Once the service gets connected, the input screen will show up. Inside the Text field select the Feedback variable from the Dynamic content panel.
- From the Action panel, find and select “Condition”.
Enter Values,
- Choose a value = “Score” variable from Dynamic Content panel
Here, Score is the output from the “Text Analytics” action.
The sentiment of feedback is depending on the score:
- If Score < 0.3 then, feedback has a negative sentiment.
- If Score =>0.3 and <=0.7 then, feedback has a neutral sentiment.
- If Score >0.7 then, feedback has a positive sentiment.
- For the negative sentiment, the condition must be as per below image.
- If this condition is true, then send an email to the owner saying the submitted feedback has negative sentiment. Select Yes in the if section, find and add “Send an email” from the Action panel. Set below values:
To = Owner email
Subject = Any text valueBody = Any text value conveying the negative sentiment. - Now, if Sharepoint Developer wants to perform an action when this condition is false then an action can be placed inside it. For the “If No” section. If there is no action required to be performed then keep it blank.
- Similarly, for positive sentiment, add the condition and the send email action as per below image.
- For neutral sentiment, add the condition in advanced mode and then apply ‘send email’ action.
- In this case, the condition is a combination of two different conditions then the syntax will be like this:
Condition = ‘@and(greaterOrEquals(body(‘Detect_Sentiment’)?[‘score’],
0.3),lessOrEquals(body(‘Detect_Sentiment’)?[‘score’], 0.7))’
- The flow is ready to provide the sentiment of a submitted feedback. See below screenshots for these 3 different sentiments.
Negative Sentiment Feedback:Positive Sentiment Feedback:Neutral Sentiment Feedback:
Optical Character Recognition to Text
SharePoint is popular as a document management system and most of the time while providing SharePoint consulting service, we face challenges in extracting text from an image. Let us examine what to do and how to do in such cases.
Flow requirement: Whenever a new image is uploaded, a flow will extract text from the image and an email will be sent to an owner with that text. Let’s say, there is an Image Document Library to upload images as shown below.
- Follow 1, 2 and 3 steps from the Text Analytics example. Then start below steps,
- From the Trigger panel, find and add trigger When a file is created (properties only).
Set values
- Site Address = Site collection URL
- Library Name = Name of library where images will be uploaded.
- Folder = Empty (i.e. Root Folder)
- From the Action panel, find add action Get content.
Set values:- Site Address = Site collection URL
- File Identifier = Select “Identifier” variable from Dynamic content panel
- From the Action panel, find and add service “Optical Character OCR to Text”. If this service asks for Account Key and Site URL values, then provide the respective noted values of Computer Vision API.
- Connection Name = Any name here
- Account Key = Enter key value noted while adding this Service API i.e. either Key 1 or Key 2.
- Site URL = Enter endpoint value noted while adding this Service API.
- After providing the above values, set below values:
- Image Source = Image Content
- Image Content = File Content variable from Dynamic Content panel
- The above action will extract text from the uploaded image.
- From Action panel, find and add Send an email action, and set values:
To = Owner email
Subject = Any text value
Body = Any text value with variable Detected Text from the Dynamic Content panel. “Detected Text” is an output of OCR to Text service.
- Save the flow and upload the image in the Image Document Library. For example: below image is uploaded in the library.
- The below email will be sent to the owner.
Recognize Domain Specific Content
Well, this is an interesting service for SharePoint Development. If you are a software developer, you might have faced issues of recognizing a person’s identity in an image. In such scenarios, one can use ImageDocumentLibrary.
Flow requirement: Whenever a new image is uploaded, flow should be able to rectify the celebrity faces and their name from the image.An email will be sent to the owner with those names.
- Follow 1, 2 and 3 steps from Optical Character Recognition to Text example.
- From the Action panel, find and add “Recognize Domain Specific Content”. If this service asks for Account Key and Site URL values, then provide the respective noted values of Computer Vision API. a. Connection Name = Any name here b. Account Key = Enter key value noted while adding this Service API i.e. either Key 1 or Key 2. c. Site URL = Enter endpoint value noted while adding this Service API.
- After providing above values, set below values:
- Domain Model = celebrities
- Image Source = Image Content
- Image Content = File Content variable form Dynamic Content panel
- The output of the above action will be an array of celebrity names.
- From the Action panel, find and add “Send an email” action. Set values,
- To = Owner email
- Subject = Any text value
- Body = Any text value with Celebrity Name variable from Dynamic Content Panel. Here, “apply to each” action will be automatically added which will iterate through each celebrity image available.
- Save the flow and upload an image in the Images Document Library. For example: below image is uploaded in the library.
- The following email will be successfully sent to the owner.
Conclusion
Experts from the industry are sure that the rise of AI will offer a better future to all the humans and businesses involved in the technology arena. With the same intent, Microsoft has provisioned many “Cognitive Services” apart from the ones mentioned above that empower SharePoint consultants. With full liberty, one can explore them based on their requirements. Many complex business requirements are easily achieved in comparatively lesser time but with higher efficiency using Microsoft Cognitive services. We hope through this blog, we have helped you in exploring the services they provide and you have an answer for all your questions. So, why not take the advantage of these services that are easily integratable with other popular platforms like Twitter, MailChimp, Dynamics 365 etc.
Shital Patel
Shital Patel is VP at TatvaSoft with a high-level of proficiency and technical precision in SharePoint Development. His experience of the last two decades has helped businesses to solve complex challenges resulting in growth and performance of Startups to Fortune 500 companies.
Subscribe to our Newsletter
Signup for our newsletter and join 2700+ global business executives and technology experts to receive handpicked industry insights and latest news
Build your Team
Want to Hire Skilled Developers?
Comments
Leave a message...