Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
This article shows an example how you can configure a Qlik Application Automation workflow to generate a simple report using Qlik Reporting Services and attach it as a PDF file to a message sent in Microsoft Teams channel. The main challenge addressed is the configuration of the necessary Microsoft Sharepoint and Teams blocks.
Content:
Necessary Automation blocks:
Create a new automation using one of the provided Qlik Reporting templates: Store a simple multi-page PowerPoint report to Microsoft SharePoint
Configure Qlik Reporting blocks to generate the report needed. For more information on how to generate a PDF report using Qlik Application Automation please refer to previously posted articles (see links below).
Here is an example of a simple one-page report:
The next step is to configure Microsoft Sharepoint automation block to copy the generated PDF report to the site of your interest. Certain input parameters were already pre-filled by the template, which was used to generate this automation.
There are several ways to find the relevant information (see links to Microsoft documentation below). This article shows one example way, which you can use.
Let's assume an example scenario, where you want to share the generated PDF report in a teams channel named "My Channel". Under the files tab, you can view the files stored in the Sharepoint attached to your channel. There you can create a new folder, for example named "General", where you will store the generated report files.
To find the driveid and siteid of this Sharepoint site, you can use Microsoft Graph Explorer and retrieve the necessary information by executing a chain of API calls.
1. First, you must log in to your Microsoft account:
2. Knowing the name of your Teams channel ("My Channel"), you can start a search for sites with this keyword:
https://graph.microsoft.com/v1.0/sites?search={Keyword}
Looking at the returned id, it seems like several siteids (separated by a comma) were concatenated as the example Sharepoint site contains one or more folders.
Note: this might look different in your scenario, however the returned id parameter is the one, which is required for the next steps.
3. This id parameter can now be used as siteid for the next API call, to find the rest of the relevant information for the target folder ("General").
https://graph.microsoft.com/v1.0/sites/{siteid}/drive/items/root/children
Having found the name of the target folder ("General" in the example scenario), you can copy the relevant information into Qlik Application Automation. As this information will be used across multiple automation blocks, it is recommended to store the ids in the respective variables:
4. Configure the "Copy File on Microsoft Sharepoint" block using the new variables. Additionally, adjust the destination path to use the folder "General".
Having stored the newly created file in Sharepoint, you must now retrieve the eTag of this file to be able to attach it to a message in Microsoft Teams.
Use the Microsoft Sharepoint automation block "List Items on Drive" to iterate over items in a certain folder and find the newly generated file dynamically. Use the initially created variables Driveid and Itemid as input parameters:
Include a "Condition" block into the loop to check, whether the file name corresponds to the name of the generated report you are looking for:
if {$.listItemsOnDrive.item.name} = {$.generateReport.path}
In case you have found the correct file name, store the eTag and webUrl parameters of this file in variables.
{substr: {$.listItemsOnDrive.item.eTag}, 1, {subtract: {textlength: {$.listItemsOnDrive.item.eTag}}, 4}}
{$.listItemsOnDrive.item.webUrl}
Exit the loop, as you have already found the necessary information.
Insert a Microsoft Teams automation block "Send Message" at the end of your automation. Use the lookup functionality to define your team and channel id, where the message will be posted.
Write the content of your message. Use the following tag in the Content field to insert an attachment into the message. The id of the attachment should be the eTag of the file previously stored in the "FileTag" variable.
<attachment id="{$.FileTag}"></attachment>
Define the attachment code as follows:
[{"id": "{$.FileTag}",
"contentType": "reference",
"contentUrl": "{$.webUrl}",
"name": "{$.generateReport.path}"
}]
This is how it might look like in the end:
Save the automation and execute it. You will now receive a message in your Teams Channel with the content and attachment you have defined:
The information in this article is provided as-is and to be used at own discretion. Depending on tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.
Great Work Katja