I was listening to my friend Sue Hanley speak on a user adoption panel, and she mentioned a problem. Users can’t easily see whether a page is published or not because of the way that versions work in SharePoint, and I realized there was a simple answer. In the process, I slammed into a defect, and it’s one that hasn’t been resolved. However, if you’re interested in a one-time snapshot of what’s published you can still use this trick. Skip down to the Calculating Published header if you don’t want the backstory.
Major and Minor Versioning
We’ve had major and minor versions in SharePoint since the beginning. Most document libraries have simple, major versioning enabled, which uses integers to differentiate one version from the next. The latest version is the version with the highest number. If you want to know what the users see by default, it will always be the highest numbered version.
Major and minor versioning is enabled for pages libraries, and it uses a floating-point number to represent the version. Everything to the left of the decimal (whole numbers) is the major version and everything to the right are the minor versions. The challenge comes in that users who have read access don’t get the highest numbered version. They get the highest version with no decimals (i.e. the largest version that ends in .0). This causes confusion, because anyone with editor status will see the highest number – including minor versions. So, a user calls and says they can’t see something that the editor or creator can see.
When a content manager publishes a page, it’s converted from a minor version to a major version and they can see it. However, it’s not easy to see whether pages have been published or not. You can display the version, but you must remember that only major versions are seen by users. If only there were a column that let you know whether the page was published or not.
SharePoint’s support for calculated columns allows us to do simple operations, and we can take advantage of some Boolean logic to create a column named “Is Published” that will tell us if the item is published. We do this with a simple formula:
We’re subtracting the integer portion of the version number from the rest of it, leaving us with only the remainder. If that is equal to 0, then the version is a major version and thus the page is published.
Here are the steps to add the column to your Pages library – and the default view:
- Navigate to the Pages (or Site pages) library of your site.
Figure 1: The Site Pages Library
- In the upper right-hand corner of the page, click the gear icon to open the Settings pane.
- Click Library settings. The library’s Settings page will open.
Figure 2: The Site Pages Settings Page
- In the Columns section, click Create column. The Create Column page will open.
Figure 3: The Create Column Page
- In the Column name field, give a name to your column, such as Is Published.
- For the column type, select Calculated (calculation based on other columns). The page will refresh to show additional options in the Additional Column Settings section.
- In the Formula box, type (Version-Int(Version))=0.0.
- For the data type returned from the formula, select Yes/No.
Figure 4: The Configured Formula and Selected Data Type
- Make sure Add to default view is checked, then at the bottom of the page, click OK. The column will be created, and you’ll be returned to the library’s Settings page.
- To return to the library, at the top of the page in the breadcrumb bar, click the name of your pages library. You’ll be returned to the default view, where you will see the new calculated column. (We’ve also included a Version column to indicate that drafts are listed as No and published pages are listed as Yes.)
Figure 5: The New Calculated Column in the Site Pages Library
- First, we’ll edit a draft page, but we’ll save it as a draft instead of publishing it. Click the name of the page to open the page in a new tab. In the command bar, click Edit, then make any changes as needed. When you’re finished making changes, in the command bar, click Save as Draft. The page will be saved as a draft, but not published.
Figure 6: The Save As Draft Button
- Return to the pages library. The calculated column should read No, because it isn’t published – but it doesn’t. This is the defect. The calculated column isn’t getting updated when the version is changing.
Figure 7: The Calculated Column
For now, you can create the field when you need a snapshot. Hopefully, Microsoft will fix the defect soon, and we’ll be able to have a simple column that shows whether a page is published or not. If you want to support Microsoft fixing the issue, upvote the User Voice suggestion at https://office365.uservoice.com/forums/264636-general/suggestions/38413258-calculated-columns.
No comment yet, add your voice below!