Determine if a site page has a published version
Category
- [x] Question
- [ ] Typo
- [ ] Additional article idea
Question
Dear PnP team,
I'm currently struggling to find out, if a site page has a published version. Or in other words: if a user with just read-rights visits the site, can he see the page.
Looking at the version string is not enough, because if a page (with version 2.0) is unpublished, it can have version 1.2 and has no published version and is not visible to visitors. Another page with version 1.2 that is published will be seen by visitors.
I dug quite deep in the system fields (e.g. _level and ModerationStatus) of a site page but didn't find any indicators that tell me if this page will be visible by visitors or not. Is this really the case or did I miss something?
Any help would be highly appreciated.
Greetings Tobias
Environment details (development & target environment)
- Target Environment: SharePoint Online
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
@nmtoblum if you have versioning configured for both major and minor versions, whenever a page is published the version number increments to the next major version e.g. from 1.xx to 2.0 or 2.xx to 3.0 and so on.
If you make a change to a page and save it is a draft, the minor version number is incremented and the major version number stays the same e.g. 1.1 to 1.2, or 2.23 to 2.24
So if you are able to see the version number and it has a zero (0) as the minor version number you know that it is a major published version.
Your Draft item security settings will determine what a general user (Visitor) is able to see. If your Draft Item security is set as follows, only Members and Owners will be able to see draft changes of a page (minor versions).

If your draft item security is set like this however, visitors will be able to see draft changes to a page.

These settings can be found in your library settings for your pages library:

There are other settings which will influence your page publishing life cycle such as content approval and content approval workflows (through PowerAutomate), however the same principles above will still apply.
Hope that helps! :)
Hello, Arnie,
thanks for your detailed explanation of the versioning behavior. (What I forgot to say: I refer to the default versioning settings of the SitePages library, i.e. major/minor with draft item security "only users who can edit".) So far this is also in line with my knowledge. And this is how I have implemented it so far.
But everything gets complicated when the "unpublish" function comes into play. Let me give you an example:
Let's think about the following versioning process:
- 0.1 -> 0.2 -> Publish -> 1.0 -> 1.1 -> 1.2 This would mean that an editor sees version 1.2 and a visitor sees version 1.0. So far so clear.
But let's have a look at this case:
- 0.1 -> 0.2 -> Publish -> 1.0 -> 1.1 -> Publish -> 2.0 -> Unpublish -> 1.2 This would mean that an editor sees version 1.2 (with the content that was previously included in version 2.0) and a visitor does not see the page at all.
In both cases an editor sees version 1.2, but in the first case a visitor sees a page (1.0), in the second case not. For the editor this would be an important info, but it is not visible only by the version. And i did not find any other indicator in the fields that would tell me that.
Now the feature "scheduled publishing" will be rolled out soon. I have not yet been able to investigate how the versions work here, but this should be just as complex.
I hope you understand my point and my problem with this "edge case". Do you have insights also for these cases for me?
Many greetings Tobias
This issue is being closed as part of an issue list cleanup project. Issues with no activity in the past 6 months that aren't tracked by engineering as bugs were closed as part of this inititive. If this is still an issue, please follow the steps outlined to re-open or submit a new issue.
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues