Unified hub - cleaning up old Nprinting reports and QlikView links
In our environment we linked both QlikView documents and Nprinting reports within the unified hub interface of Qlik Sense. However, these links did not get removed at all, which was making the interface not very user-friendly.
If an actual report is removed from NP server, the report stays on the server. This is reported as a bug (OP-6802). The below text contains a work-around.
There is a major difference between the Nprinting reports within Unified hub and QlikView documents.
Attached is a PowerShell script which checks if there is a valid task for the report, which in case it stays. ( cleaning_Nprinting_reports_on_hub.ps1 ). Your account running this service must have the rights to see all the shared content on the server. A solution could be to add the following security rule (for shared content):
Actions: Create, Read
Conditions: ((user.userId like "*" and resource.owner.userId=user.userId)) or ((user.userId="SERVICEACCOUNT"))
Context: hub and QMC
The first part of the script ensures that only users can see what is posted to them, and noone else. The second part ensures that the service account (running the attached PowerShell script), can see all objects.
The script is first using QS APIs to verify which reports exists on the hub, to find the metadata-tag for which task-id it was generated with. The script then uses this task-id for the report and cross-checks using NPrinting APIs to check if the tasks actually exists, where upon it either does nothing or removes the report on the QS hub.
If there is no task, the report is removed.
If there is a task but the user is just removed from the task, the old report will stay, you will then need to either clean manually or clean all. Most of the times - it doesn't matter as the user is looking at old information which he/she once had access to.
"Created date" within the Qlik Sense hub section "Reports", means the date when the first link was established.
Any report update timestamps will not be shown in the "created date", meaning it is a good practice to keep date/time within the report. There are no dynamic report names within the hub, or Newsstand, only email and such.
The script can be scheduled with Windows Task Scheduler, e.g. once a day to clean up links. Usually it only finds links on the very first run, or if something is changed.
It is possible to just clean all the Report links with another script ( just_clean_everything_on_hub-reports.ps1 ). That script is only based on QRS API. It is not recommended to just look in the folder of C:\<QlikRoot>\StaticContent\SharedContent and use the ID there to process the DELETE API command, as some reports is still available on the hub. The ID there though, e.g. C:\<QlikRoot>\StaticContent\SharedContent\e86dfdfd-a0d4-4cc4-9053-ce9ce1a53c8a corresponds to the id in the URL https://QLIKSENSESERVER/sharedcontent/e86dfdfd-a0d4-4cc4-9053-ce9ce1a53c8a/20180110T090524Z/report01.xlsx .
Deleting the links for the QlikView Documents.
There is also a cleaning script for QlikView Doc links to remove all links ( just_remove_everything_on_hub-qlikdoclinks.ps1 ). Naturally this can be modified to only use a specific folder or similar by using the WHERE command within the pipe of the PowerShell script. The service account requires access to all links (see above for security rule).
Currently it is not possible to unpublish from the Qlik Sense Hub. As a work-around, you can modify the distribution task to distribute only to a single administrative user which will remove the links to the QlikView documents from other user’s view.
The end-user can within the Qlik Sense hub section of "QlikView Documents", also right click > Delete.
Any changes to a QlikView task will create a second link, setting up a Unified hub link should thus be the last thing you do when scheduling.