pnp / List-Formatting

List Formatting Samples for use in SharePoint and Microsoft Lists
https://pnp.github.io/List-Formatting/
MIT License
1.76k stars 843 forks source link

Added column sample generic-published-version #850

Open mkacena opened 3 days ago

mkacena commented 3 days ago
Q A
Bug fix? no
New sample? yes
Related issues?

What's in this Pull Request?

Added new sample generic-published-version.

This sample creates a button for downloading the currently published version of a document. The sample is supposed to be used in a SharePoint Online document library with minor versions enabled. Button is displayed for every document with a published version, i.e., version at least 1.0. It is linked to the latest published version of the document - for example, if the latest draft of the document is at version 2.6, the button downloads version 2.0.

tecchan1107 commented 22 hours ago

Hi @mkacena . Thank you for sharing this awesome sample! I didn’t know it was possible to open a specific version of a file this way—very cool!

After trying it out, I had one point of concern regarding the "Download" button.

I thought clicking the button would download the file, but when I clicked it, it did not download, but opened the specified version of the file. Therefore, I felt a little uncomfortable with the button labeled "Download"...

If you agree with this, how about replacing the label “Download” with some other letter? (e.g. Open Version XX.0)

⚠️ If you replace it, I am sorry, but you will need to modify the screenshots and README as well as the JSON.

mkacena commented 20 hours ago

Hi @tecchan1107 . Thank you for your feedback. Can I ask how did you manage to get the file open? This was actually my main concern - that it downloads files instead of opening them in browser or app. I have tried it in 2 different tenants with libraries of different settings, and different browsers (Firefox, Chrome), but it always downloaded the file. I would be actually happy if I could make it open the previous version instead of download.

tecchan1107 commented 5 hours ago

Can I ask how did you manage to get the file open?

I did not set anything in particular, but the file opened...

When I click the download button in my environment, I get the following behavior (sorry for the Japanese)

word

However, when I clicked on the Visio download button, the Visio file was downloaded.

visio

In my environment, I have desktop apps like Word, PowerPoint, and Excel installed, but the Visio desktop app is not installed.

Maybe the file is opened or downloaded depending on whether the target desktop app is installed or not...?

tecchan1107 commented 5 hours ago

For reference, if it is a PDF, the PDF was opened in a separate tab.

pdf