Views are a great way to create multiple “reports” or ways of viewing the data contained in a SharePoint list or library. For example, you may want one view for managers, and another view of the same data targeted towards everyday users. In this lesson, you’ll learn about columns and how they’re used to create specific views.
This video is part of my FREE 30+ lesson self-paced online training course called Collaboration in Microsoft 365 (OneDrive, SharePoint, and Teams). Enroll today at https://www.NateTheTrainer.com for the full learning experience including lesson discussions, quizzes, exams, and a completion certificate.
Normally, to download a document in modern SharePoint Online libraries, we would have to use a file’s menu (right-click or ellipsis) then choose Download.
I was recently challenged to help figure out how to create a single click experience to immediately download a document in modern SharePoint Online libraries and after much trial and error was able to do so using a little bit of JSON in a calculated column.
Here’s how to create a Download link column in modern SharePoint libraries:
1. Create a calculated column (Library Settings > Create Column) named Download and set its formula to =””
2. Copy and paste the following JSON code into the JSON formatting field of the calculated column settings.
3. Set the new column to show in the default view so it’s visible in the library and click OK.
4. Return to your library, and test it out!
And if you want anonymous users to be able to use these convenient download links, be sure to share a FOLDER link with the anonymous user(s) so they will see the file in the library alongside the one-click download link.
Optional formatting of the Download link
And while I’m not a JSON expert, I did dabble a bit in stylizing the Download link so it would look a little bit better. You can add a little bit of style to the JSON to achieve a more button-like experience (or for the advanced among you, change the element to an actual button or download icon).
Here’s how you can get started stylizing the text link (see result at bottom):
Normally in modern lists and libraries you could show/hide columns that already exist by selecting the column header titled “+ Add column” then “Show/hide columns” as seen in the screenshot below.
However, when we do this, Version isn’t an option.
Solution #1: Edit the current view
We visit some classic SharePoint settings to find this column. Simply follow the steps below to add the “Version” column to your list or library view.
1. Go to the list or library and make sure it’s on the view to which you’re adding a column for Version
2. Select the view name (All Items or All Documents is default) then Edit current view
3. Scroll down to the bottom of the list of column names and select the checkbox next to Version.
4. Click OK at the top or bottom of the screen to save.
Note: If you want to rearrange the order of columns as well (perhaps placing Version between other columns) then be sure to change its corresponding number next to its row in the view settings as well.
Solution #2: Edit the view through List/Library settings
Rather than using Edit current view from the view itself, you can also get to the same view settings by going to Settings > List Settings or Settings > Library Settings.
Scroll down to the Views section and select the name of the view for which you’re adding the Version column then proceed with steps 3 and 4 from Solution #1.
And through either method, now we have a column for Version added to our view.
This is such an obscure topic, but maybe it will help somebody curious out there. I recently had a request to alter a classic experience list with a single hyperlink column so that users could click in the white space of a cell and it takes them to that cell’s hyperlink value as if they’d actually clicked the link.
To illustrate what I mean, notice how the arrow pointer changes to a hand cursor like the whole cell is clickable. And when white (blue) space of the Google link is clicked, it takes us to Google anyway:
This was done with the tiniest bit of CSS added to the page inside a <style> tag. Note that this will affect all links in tables on the page to which it’s applied. So if you have more than one table on the page, this could cause issues. But in my case I just had the single-column list I was working with and this sufficed.
I borrowed from Microsoft’s documentation on conditional column formatting recently to modify a modern experience list in SharePoint 2019. This also works for SharePoint Online/O365, but will not work in classic experiences (or pre-2019 server versions). I modified Microsoft’s example on conditional background colors for a numeric range and created a similar conditional column formatting result for text values.
In this example, I have a list for upcoming training opportunities. There’s a column named “Level” which is a choice field of either Beginner, Intermediate, or Advanced. The JSON code at the bottom of this post changes the column’s background color value to green, yellow, or red respectively based on the level selection. Here’s a demonstration of the result:
You could modify this code to suit your own column’s values/options, then paste it into the Column Formatting section of that column’s settings (List settings > Select column from Columns section). Do not change @currentField in the JSON code – that’s just a reference to whichever column you add it to and doesn’t need to be your column’s name.
Mark Rackley recently tweeted about the ability to create a calculated column in SharePoint online document libraries that would automatically render thumbnails for documents. In the GIF from his tweet, it shows how this works for media files.
Naturally curious, I had to see how this worked for documents of .docx, .pdf, .pptx, etc. types. What I found is that it only currently supports some file types:
Supported file types (there’s likely even more I didn’t test):
Images (.png, .gif, .jpg, etc.)
Not-yet-supported file types:
Create a thumbnail column in SharePoint Online document libraries
1. Add a new column to your document library (library settings > Create column).
2. Set the column name to Thumbnail. As for type, you have two options:
Leave type as Single line of text. Thanks to Dario Cassinerio for sharing that Single line of text type works as well as (and more simply than) Calculated set to [Title].
The following column validation formula worked fine in SharePoint on-prem (2016 specifically, in my case), but returned an error when used in the exact same context in SharePoint Online’s modern UI:
The expected behavior, in SharePoint Server/on-prem OR SharePoint Online/O365, is that if someone enters a date beyond the current date, they’ll get an error message and cannot submit the form until it’s corrected and the validation formula resolves to TRUE.
Troubleshooting in SharePoint Online
I used this formula in SharePoint Server/on-prem, and it worked fine. Then I tried using the modern UI in SharePoint Online by using the column’s menu > Column settings > Edit.
But when you try to save the exact same formula (specifically from the modern experience side panel) you get the error “A formula has a syntax error.”
Then I decided to try the classic view of settings to compare on-prem and online as closely as possible. I went to Settings > List settings and selected my column.
And, as you already know, it WORKED when entered on this classic column settings page (in SharePoint Online still) instead of the modern column settings side panel accessed directly from the list view.
When I go back through the modern UI now that my formula saved successfully, I see what caused the problem. The modern UI requires that you begin the formula with an equals sign (=). When I created the formula through the classic column settings method, it automatically added the equals sign for me in the background.
So if you’re creating column validation formulas in the modern experience (or even in classic), just remember to add an equals sign (=) to the start of your formula.
The difference is simply which formats are accepted.
Classic: Start formulas with or without equals sign