Please specify what version of the library you are using: [ 2.0.5 ]
Please specify what version(s) of SharePoint you are targeting: [ Online ]
I get a modern page template through "ClientsidePageFromFile" method of @pnp/sp/clientside-pages. Template has disabled comments, so I expect variable "commentsDisabled" returns true.
When I get modern page template, variable "commentsDisabled" is always false, no matter how I configure comments.
I get my page this way:
let templatePage = await ClientsidePageFromFile(web.getFileByServerRelativePath("/sites/MySite/SitePages/Templates/MyPageTemplate.aspx"));
await templatePage.load(); // I tried to load template before check comments, but it didn't work either.
if(templatePage.commentsDisabled) { //Always is false.
//Do some stuff when template comments are disabled
}
else {
//Do other stuff when template comments are enabled
}
Is there something I'm doing wrongly?
Thanks in advance.
I can confirm that it is indeed a bug, unfortunately it doesn't appear to be ours. If you look at the network console you can see that when the metadata is retrieved for the page that field's value always comes back false, and the library is only then passing through that result. So, unfortunately it looks like there's nothing we can do about it other than to document the issue but I'll discuss with the rest of the team and we can see what the best approach is.
I am not sure we can take this as a bug if the server is returning the wrong data? We have no path to resolution.
I listed it as such so that we can discuss and see if we want to adjust documentation in some way... as it is a bug just not ours... but happy to remove the label.
@juliemturner - we can close this with the docs update, yes?
Most helpful comment
I can confirm that it is indeed a bug, unfortunately it doesn't appear to be ours. If you look at the network console you can see that when the metadata is retrieved for the page that field's value always comes back false, and the library is only then passing through that result. So, unfortunately it looks like there's nothing we can do about it other than to document the issue but I'll discuss with the rest of the team and we can see what the best approach is.