Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!

Unified hub - cleaning up old Nprinting reports and QlikView links

cancel
Showing results for 
Search instead for 
Did you mean: 
ergustafsson
Partner - Specialist
Partner - Specialist

Unified hub - cleaning up old Nprinting reports and QlikView links

Last Update:

Dec 2, 2022 3:04:51 AM

Updated By:

Sonja_Bauernfeind

Created date:

Jan 12, 2018 7:35:22 AM

Attachments

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.

You can read more about unified hub on the help site: Qlik NPrinting reports in Qlik Sense ‒ Qlik Sense .

20180112 131137-20180110 082839-Qlik Sense.png - Windows Photo Viewer.png

Deleting the links for the Nprinting reports

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):

Resource-filter: SharedContent_*

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.

Good luck!

Changelog:

  • Version 1.0 - 2018-01-12 (Initial version)
  • The scripts are tested with Qlik Sense September 2017 and Nprinting September 2017
Labels (1)
Comments
lkartchner
Contributor III
Contributor III

Thank you so much for all this.  All I had been able to find for cleaning up Qlikview documents was articles about going into the repository database directly; and I wasn't really fond of doing that!  The comment in this article that helped me was the part about "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."  Since I was decommissioning the Qlikview document (and I'm the administrator) it was ok for me to remove all others from the distribution of the Qlikview task except myself.  I was then able to go into the Qlik Sense hub and delete the document from the my "Qlikview Documents" stream.  Mission accomplished!!


I'm sure I could have spent more time figuring out how to modify the provided script to only delete one Qlikview document but the process I followed was very understandable and allowed me to use normal QMC activities.


thanks

ergustafsson
Partner - Specialist
Partner - Specialist
bm_mk
Partner - Contributor II
Partner - Contributor II

First of all I realise I am replying to a very old thread, but since Qlik has still not properly solved this issue as far as I can find anywhere. I would like very much to implement your solution. It is the only post about this that I can find that seems to present an actual solution.

However I get the following issue:
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. powershell

If I try to circumvent it, it just seems to run with no result. Any ideas?

I am trying to delete orphan (or all) NPrinting Reports from the hub, because users are now seeing up to 10 (or more) old invalid report links in their hub.

Kind Regards,

MK

ergustafsson
Partner - Specialist
Partner - Specialist

@bm_mk  I believe it is due to TLS earlier than version 1.2 being used. Try adding:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

..at the start of the script.

bm_mk
Partner - Contributor II
Partner - Contributor II

Unfortunately no, although it does seem to change the error message (below).
Thanks for your reply and perhaps I will try this again at a later time.

Invoke-RestMethod : The remote server returned an error: (403) Forbidden.
At line:25 char:9
+ $irmm = Invoke-RestMethod -Uri $url -Method GET -ContentType 'application/json' ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

ergustafsson
Partner - Specialist
Partner - Specialist

Does similar script statements work?

Can you connect to the QRS API in other scripts and/or the NPrinting API?

Get that to work first, even the most basic connectivity, to ensure that the error does not lie in this script 🙂

bm_mk
Partner - Contributor II
Partner - Contributor II

QRS API yes of course 😉 many working processes although only with very simple Qlik-Cli functions - the NPrinting API unfortunately no other examples / no working processes in our environment.

But it helps that you think that may be where the error lies, I will discuss this with one of my colleagues to see if I overlooked something!

bm_mk
Partner - Contributor II
Partner - Contributor II

Thank you we got it working! Although we ended up using a different connection method and the Qlik-Cli module, but we built on your idea 🙂

Version history
Last update:
‎2022-12-02 03:04 AM
Updated by: