How to check whether the scheduling page feature is enabled in SPFx

How to check whether the scheduling page feature is enabled in SPFx

In my current project, I have to find out if the "Schedule" feature for communication pages is turned on. Honestly, I'm not sure if my method, which I'm sharing here, is the correct or supported way because I haven't seen any other methods online. If you know a better way or if my method is wrong, please leave a comment.

As you know, you have the property this.context.pageContext in SPFx. You also know the legacyContext property in the pageContext object. The name might be scary and probably many do not use this property because of the name. But there is a lot of information right there. And whether certain features are activated or not, among other things.

However, if you want to know whether the Scheduling Feature is activated or not, you can check this as follows:

this.context.pageContext.legacyPageContext.featureInfo.SitePagesScheduling.Enabled

BTW: The featureInfo contains a lot more information about other features

Happy Coding ;)