Sam's Microsoft Dynamics 365 Blog

Tuesday 15 October 2019

Convert a SharePoint List item to PDF Using Microsoft Flow

In many business scenarios we need to create a PDF file from the record, for example we have created a new record for Sales Order and now we need to generate a PDF document for this Sales Order.

In this article, I will be demonstrating how to Convert a SharePoint List Item to PDF using Microsoft Flow.

Here I have an AllProduct List and I have to create a record document. So, I will use Microsoft flow and create a document newly created record in my AllProduct List.

So let’s create a Microsoft Flow step by step:-

1. Login Microsoft Flow here https://flow.microsoft.com/en-us
2. Click on My flows and then Click on "create from the blank".
3. Select SharePoint and Select a Trigger “When an item is created”.
4. Now Select Site Address and List Name. Here I am Selecting the AllProduct.



5. Add a new step, Select SharePoint and Select an action “Get Items”.
6. Now Select Site Address, List Name and put filter query, e.g. ID eq ID.


7. Add a new step, search “Create HTML Table” and Select an action “Create HTML Table”.
8. Now Select From and Columns. Here I have selected "Automatic", you can select "custom" and manage according to your business requirements.


9. Add a new step, Select OneDrive and Select an action “Create File”.
10. Now Select Folder Path, File Name, and File Content. Put File Content as Output.


11. Add a new step, search “Convert File” and Select an action “Convert File”.
12. Now Select the ID of created HTML file inside File option and Select Target Type as PDF.


13. Add a new step, Select SharePoint and Select an action “Create File”.
14. Now Select Site Address, Folder Path, File Name, and File Content. In File Name don’t forget to add the extension as .pdf.


15. Now Save it.

 Here I have used AllProduct List, so let’s create a new record in AllProduct list.


Now check the run history of Microsoft Flow.


Now check the document library. Here a new file is created in my SharePoint Document Library with name, as I have put the name of Product.





Reference:
https://docs.microsoft.com/en-us/flow/getting-started


Thanks for reading the article. Hope this Article will helpful for you. Cheers!!!

Tuesday 8 October 2019

Using Computer Vision Inside Microsoft Flow(AI in Microsoft Flow)

Microsoft has introduced AI services called “Cognitive services”. There are various services categorized by Vision APIs, Speech APIs, Language APIs, and Search APIs which belong to Cognitive Services. These services can be integrated with many platforms very easily. You can find more about Computer Vision https://azure.microsoft.com/en-in/services/cognitive-services/computer-vision/

In this article, I will be demonstrating how to use the Azure Computer Vision with Microsoft Flow.

Here I am using a scenario, An Image is uploaded to SharePoint Document Library, using Azure Cognitive services image content will be converted in text format and sent the text content via email.

So, let’s start step by step.

1. Generate Cognitive Service API Key and URL:-

First, we must generate the API key for Cognitive Service. So, for that

a. Login into the Azure account.
b. Now In the left navigation, click Create a resource.
c. In Azure Marketplace, select AI + Machine Learning and then click Computer Vision.
d. Enter the required details as shown below and click Create.
e. Click on All Resources in the left navigation and then click the newly created computer vision resource.
f. Now Click Keys under Resource Management, copy the Key.

Note: - It might take a few minutes to deploy the resource.


There is another option to generation Cognitive Service API key. We can register a trial through https://azure.microsoft.com/en-in/services/cognitive-services/computer-vision/.



2. Create a Microsoft flow:-

a. Go to https://us.flow.microsoft.com/en-us/
b. Click on My flows and then Click on create from the blank.
c.  Select SharePoint and Select a Trigger “When a file is created in a Folder”.


d. Now Select Site Address and Folder Id. Here I am Selecting the Invoice folder.



e. Add a new step, Select Computer Vision and Select Action “Optical Character Recognition (OCR) to Text”.


f. Now Put Connection Name, Account Key (Generated previously in Azure) and Site URL and click on Create.


g.  Select “Image Content” as Image Source and “File Content” as Image Content.


h. Add a new step, Select Office 365 Outlook and Select Action “Send an email”.


i. Now add recipient of the email in “To”, Put File name as “Subject”, Detected Text as “Body”.

j.  Inside attachments put File name in “Attachments Name” and File Content in “Attachments Content”.

Now let’s test. I have uploaded an Invoice Image to my Invoice Document Library.


Now we can check the content of Image inside flow output.


Also, I have received an email of the Image content of uploaded Invoice Image.



Sources: -
 https://azure.microsoft.com/en-in/services/cognitive-services/
https://azure.microsoft.com/en-in/services/cognitive-services/computer-vision/
https://docs.microsoft.com/en-us/azure/cognitive-services/welcome
https://docs.microsoft.com/en-us/flow/get-started-logic-flow


 Thanks for reading the article. Hope this Article will helpful for you. Cheers!!!

Web Resource vs PCF vs Canvas App - which of the one is used?

While started working on specific Business Requirements related to custom layout, there is a always common question that "where to star...