SOLVED

any solution for requiring a user to first answer some questions before downloading a document ?

Brass Contributor

 

hi,

 

I am hoping to get some help in this forum.

Use case:

---------

I have some documents in a sharepoint document library.

1. When my users click to download the file, I want them to first answer some questions (about 4-5 fields):

a) reason for  download, 

b) customer

c) ID

d) etc

 

2. log the download of the document (date, username)

 

I don't want them to "checkout" the document. They are not authors, but will be visitors to the sharepoint site. I don't want to enable access control as I don't want to be the bottleneck either - by needing me to manually "approve/disapprove" the download. I simply want the user to fill a survey of their needs for the document, prior to the download,.

 

Can any experts please suggest some ways to enable this in sharepoint ?

 

thanks.

 

6 Replies

Hi @user_sharept ,

 

This is not something SharePoint does so you would need to look at other products in Office 365 or custom development. Couple of options:-

 

Microsoft forms - User has to submit a form to get the link ( I haven't checked if a custom thank you message on form submit can contain a hyperlink). May not capture username.

Power Apps - you should be able to build a form that does what you want.

SharePoint Framework webpart - You will be able to code something.

 

Hope that helps.

 

best response confirmed by user_sharept (Brass Contributor)
Solution

@user_sharept  as @Andrew Hodges  has said, this cannot be done out of the box with SharePoint. I don't think the Forms approach will work as there is no way for forms to know which document to give you the link to. But a Power Apps solution is certainly do-able. For your data sources you would have the documents library, a separate list to hold the details of who downloaded it and the reason, and an Office 365 Users data source so the app knows who they are - I'm assuming that the users downloading the document are inside your organization.

 

The user wouldn't need to enter their name as the app knows who they are. But after they enter the customer and the reason for the download the gallery would appear (via the visible property on the gallery) with the list of documents and a download link for each one. When they click the download link the details of their request are saved to the separate list and the document opens in the new tab in the browser for them to download.

 

You could make it more intelligent for example by filtering the documents that only relate to a specific customer. 

 

The Power App could be embedded in a SharePoint page with the Power Apps web part so the user is not able to do anything else in the library (like delete the document!).

 

A very simple example (without the filter) is attached.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

@RobElliottand @Andrew Hodges ,

First of all, thank you very much for the guidance and the example!

 

I have been able to reproduce your mp4 app on my site with some trial and error - haven't built any PowerApps before, so learning whats going on to took some time, but pausing your mp4 and zooming in to different sections helped.

 

Progress:

1. I have the form much as you designed it, displays the gallery after 2 fields are entered

2. In the gallery, after some tweaking of the fields under "Gallery1", I was able to display the fields from the sharepoint spreadsheet I wanted.

3. My Document Library has a column  "Name" for the name of the file that needs to be downloaded.

- (there are many files that are in the document library, say "file1.xls, file2.xls, file3.xls)

 

4. For the download icon that is next to the "Name" field on the Gallery1, I can specify explicit link to the file after copying it from the sharepoint site.

Clicking on this icon, downloads the file. (or asks to - open, save ?) - this is good.

 

The problem is for all the other files that show in the gallery, the link points to the same first file that I had entered into for the download icon in the appStudio for "fx=Download("https//..sharepoint.com/file1.xls")"

 

Is there a way to specify a reference to the "Name" column in the "fx" formula for download ?

I tried many ways to do this with no luck.

For e.g.,

fx = Download(https://....sharepoint.com/thisItem.Title2.value")

fx = Download(https://....sharepoint.com/app.Gallery1.Title2.Value")

fx = Download(https://....sharepoint.com/thisItem.Name")

etc..

I did see documentation on "Launch and Param" but it looks like Launch only has option to  "Open", not "Save".

Is there a way to get Download to work so that I don't need to specify explicit links for each item that is read in from the document  library, but do it for the first item and have the same behavior be applied  to all the items in the gallery ?

 

Thanks again for your help!

 

Regards,

Harsh

 

 

 

@user_sharept a couple of points here: launch only launches a url, it doesn't have anything to do with save. To save you need to use the Patch function. You've hard-coded the File1.xls file so every download link in the gallery will open that as you've realised. Follow the image below and the attached video to select an item from your gallery and then either display it (with the Launch function) or download it (with the Download function).

 

download.png

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

 

Hi @RobElliott ,

 

Thanks again for your reply.

 

When I view my Document Library in the browser, it has the format shown below for the URL  : <..>.sharepoint.com/sites/X/YCatalog/Forms/AllItems.aspx

 

I tried to create a powerApp Solution, however I think it needs a powerApp to be imported.

So, basic question is :

1. do I have to create a power app solution to see the link as you have shown below ?

 

https://...sharepoint.com/sites/powerapp-solutions/_layouts/download.aspx?...

 

In the fx formula, I did try to modify my Document Library link to 

a. 

Download("https://<..>.sharepoint.com/sites/X/YCatalog/Forms/AllItems.aspx?SourceUrl=lblFullUrl.Text")

- I was prompted - "What do you want to do with File AllItems.htm" with option to open/save/cancel.

b.

Download("<..>.sharepoint.com/sites/X/YCatalog/Forms/download.aspx?SourceUrl=lblFullUrl.Text")

- I was prompted -  "What do you want to do with download_aspx?SourceUrl=lblFullUrl_Text(132 bytes) ? with option to open/save/cancel

 

Neither of them is the filename - file1.xslx

 

What should I correct in the document library's link ?

 

thank you immensely for your help.

 

Regards,

Harsh

 

 

Hi@RobElliott ,

 

Quick update - I was able to get the download to work.

 

the actual fx I used was:

 

Download(First(Split(ThisItem.'Link to item', "?")).Result)

 

Thanks a lot for your help!

 

Regards,

Harsh

 

 

1 best response

Accepted Solutions
best response confirmed by user_sharept (Brass Contributor)
Solution

@user_sharept  as @Andrew Hodges  has said, this cannot be done out of the box with SharePoint. I don't think the Forms approach will work as there is no way for forms to know which document to give you the link to. But a Power Apps solution is certainly do-able. For your data sources you would have the documents library, a separate list to hold the details of who downloaded it and the reason, and an Office 365 Users data source so the app knows who they are - I'm assuming that the users downloading the document are inside your organization.

 

The user wouldn't need to enter their name as the app knows who they are. But after they enter the customer and the reason for the download the gallery would appear (via the visible property on the gallery) with the list of documents and a download link for each one. When they click the download link the details of their request are saved to the separate list and the document opens in the new tab in the browser for them to download.

 

You could make it more intelligent for example by filtering the documents that only relate to a specific customer. 

 

The Power App could be embedded in a SharePoint page with the Power Apps web part so the user is not able to do anything else in the library (like delete the document!).

 

A very simple example (without the filter) is attached.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

View solution in original post