how i can un-post my modern page from being set as News inside our site
-
15-01-2021 - |
Вопрос
I am working on a sharepoint online team site collection, and i added a new Modern site page, and after i publish it i got a message which allow me to post my page as a News inside our site, so i click on it:-
after that this page start to show inside our News modern web part. Now i am trying to find a way if i can un-post our page from the News modern web part, but i could not find any. For example i navigate to the page and i click on the Promote link, where i got this :-
and could not find any option that can allow me to un-post my page from the News web part. so can anyone advice on this please?
Решение
You need to use DemoteNewsArticle
method the PnPClientSidePage
to un-publish
it as news article.
Use the PnP commands as mentioned below:
Connect-PnPOnline -Url "https://tenant.sharepoint.com/sites/test"
# url of the page without aspx or title of the page
# if your page url is Test.aspx, pass the Identity parameter as Test
$clientSidePage = Get-PnPClientSidePage -Identity "Test"
$clientSidePage.DemoteNewsArticle()
If you want to Promote it again, the use:
$clientPage.PromoteAsNewsArticle()
Reference - ClientSidePage.DemoteNewsArticle Method
Update - No way its possible OOTB. However, the whether its published as news or not is determined by PromotedState
column value. You can choose via PowerShell to show its value in the edit form of the Site Page. Now, when the value is set to 0, it will be unpublished , when its set to 2 , it will show up in the news.
Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/test"
$context = Get-PnPContext
$list = Get-PnPList -Identity "Site Pages"
$context.Load($list.Fields)
$context.ExecuteQuery()
$field = $list.Fields.GetByInternalNameOrTitle("PromotedState")
$field.SetShowInEditForm($true)
$field.Update()
$context.ExecuteQuery()
This column is by default hidden, so we are just showing it on the edit properties page. So, if by mistake some user has posted it as news, they can simply change the value to 0 in the edit form.
Другие советы
Apparently it's easy with a grouped view, where you move them between page status groups. https://youtu.be/ZhVoYyo9TY4?t=75