Crow Canyon Software Forum

Forum Navigation
Please or Register to create posts and topics.

Downloading a document

In a form for a document library item, is it possible to download the document from the form itself, possibly using a Custom Action? We have a need to record when a document is downloaded and by whom, and to then set the permissions on that item/document.

I'm at a loss at this point, but our management seems to think it should be trivial. 😟

Thanks for any insight.

Hi Art,

We can achieve this by using custom actions and NITRO Workflows. Please find the details below.

Prerequisites:

  1. Logs list – To store records of file downloads.
  2. Custom action in the document library – To trigger downloads and create logs.
  3. Workflow in the logs list – To set permissions when a file is downloaded.

Please follow the below steps provided

  1. Logs list:
    1. Create a new custom list
    2. Create the following columns
      1. Downloaded By (Person or Group)
      2. Downloaded Date (Date and Time)
      3. Library Item (Lookup to Document library list)

 

  1. Custom action in the document library:
    1. Add an ‘Execute Script’ action and paste the following script in it

var currentItemId = currentItem.get_id();

var siteURL = "https://sample.sharepoint.com/sites/Nitro/ /_layouts/15/download.aspx?UniqueId=";

var uniqueID = currentItem.get_item("UniqueId").toString();

var downloadURL = siteURL + uniqueID;

window.location.href = downloadURL;

functionCallback();

 

NOTE: Please replace the siteURL to your site URL

  1. Add an ‘Add Item’ action and follow the configuration provided below (See attachment)

 

  1. Go to NITRO forms of the document library
    1. Drag and drop ‘Custom action’ button from Actions (See attachment)
    2. Rename the button Title as ‘Download’ and select the action in the ‘Select custom action’ option(See attachment)

 

 

 

  1. Workflow in the logs list
    1. Create a ‘Item created’ workflow on the logs list
    2. This workflow will have ‘Manage Permissions’ action that will run for the lookup item
      1. Configure the permissions of the items as required

 

 

 

Uploaded files:
  • Add-Item.png
  • CA-Button.png
  • Button-settings.png