0

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:-

enter image description here

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 :-

enter image description here

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?

1

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.

enter image description here

  • thanks for the reply,, So you mean i can not do this from the UI itself? what if a contributor user post the page as News by mistake? then this user can not un-post the page? looks weird how sharepoint online is managing this?? – john Gu Apr 22 '18 at 22:32
  • 1
    Check updated answer. Looks like nobody has faced this scenario :) – Gautam Sheth Apr 23 '18 at 4:42
  • but i always try not to show fields which sharepoint hide by defualt, as i am not sure why sharepoint has chosen to hide this column by default , and i am also not sure if there are any risks of showing this filed in edit form?? i did not find any documentation about this – john Gu Apr 23 '18 at 9:12
  • 1
    Because there isn't :) , as far as i know there is no risk in doing this. Also, check the links here ,here and here. Lots of suggestions and a product roadmap suggesting that this will be available in the near future. – Gautam Sheth Apr 23 '18 at 9:24
  • 1
    both are fine AFAIK – Gautam Sheth Aug 29 '18 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.