Crow Canyon Software Forum
Downloading a document
Quote from pf-amalin on November 14, 2024, 7:48 pmIn 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.
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.
Quote from supportTeam on January 14, 2025, 1:45 pmHi Art,
We can achieve this by using custom actions and NITRO Workflows. Please find the details below.
Prerequisites:
- Logs list – To store records of file downloads.
- Custom action in the document library – To trigger downloads and create logs.
- Workflow in the logs list – To set permissions when a file is downloaded.
Please follow the below steps provided
- Logs list:
- Create a new custom list
- Create the following columns
- Downloaded By (Person or Group)
- Downloaded Date (Date and Time)
- Library Item (Lookup to Document library list)
- Custom action in the document library:
- 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
- Add an ‘Add Item’ action and follow the configuration provided below (See attachment)
- Go to NITRO forms of the document library
- Drag and drop ‘Custom action’ button from Actions (See attachment)
- Rename the button Title as ‘Download’ and select the action in the ‘Select custom action’ option(See attachment)
- Workflow in the logs list
- Create a ‘Item created’ workflow on the logs list
- This workflow will have ‘Manage Permissions’ action that will run for the lookup item
- Configure the permissions of the items as required
Hi Art,
We can achieve this by using custom actions and NITRO Workflows. Please find the details below.
Prerequisites:
- Logs list – To store records of file downloads.
- Custom action in the document library – To trigger downloads and create logs.
- Workflow in the logs list – To set permissions when a file is downloaded.
Please follow the below steps provided
- Logs list:
- Create a new custom list
- Create the following columns
- Downloaded By (Person or Group)
- Downloaded Date (Date and Time)
- Library Item (Lookup to Document library list)
- Custom action in the document library:
- 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
- Add an ‘Add Item’ action and follow the configuration provided below (See attachment)
- Go to NITRO forms of the document library
- Drag and drop ‘Custom action’ button from Actions (See attachment)
- Rename the button Title as ‘Download’ and select the action in the ‘Select custom action’ option(See attachment)
- Workflow in the logs list
- Create a ‘Item created’ workflow on the logs list
- This workflow will have ‘Manage Permissions’ action that will run for the lookup item
- Configure the permissions of the items as required
Uploaded files: