Forum Discussion
Deleted
Apr 10, 2018Change News Page to Site Page
Hi All,
I'm looking for a method of changing a News Page to a Site Page. These pages were created prior to the hub sites being rolled out, now they are showing up in the News sections of all pages.
I'm familiar with the Promoted State column, but I haven't been able to find instructions on how to actually change the value in that column. I've seen references to using Flow but never any instructions on actually doing that.
Any tips on this would be appreciated.
- DeletedApr 10, 2018
Ok, I finally got this to work without Using flow. Do the following.
1.Go to Site Pages on your Site.
2.Change your view to "All Items"
3.Now Click the + to add a column to view, and select Show/Hide Columns
4.Check Promoted State column and click "Apply" at the top.
5.Now Click the view drop down and Save view as
6.Name it "All Items and State"
7.Now you should be able to click "Quick Edit" and then Promoted State column will be exposed to change the value. Change the page you no longer want to be news from 2 to 0 and Click exit and your page can now be a Site page again.
- Kevin BelangerCopper ContributorYou can use PnP PowerShell to do this by changing the PromotedState field from 2 to 0
#change to your site address
$SiteURL = "https://crescent.sharepoint.com/sites/Intranet"
#Connect to Site
Connect-PnPOnline $SiteURL -Interactive # to use web creds, replace with 'Connect-PnPOnline -Url $SiteURL -UseWebLogin'
#Get all Site pages - along with their IDs
Get-PnPListItem -List "SitePages"
#Demote News page with ID "4" to Site Page
Set-PnPListItem -List "SitePages" -Identity 4 -Values @{"PromotedState"="0"}
For reference, see https://www.sharepointdiary.com/2020/03/promote-site-page-to-news-page-in-sharepoint-online.html - npajak22Copper Contributor
Hello,
Have there been any recent developments in this? I setup my page as indicated in the solution here but the column is now greyed out and says it is a read-only field.
Thank you,
Nicole
npajak22 Try solution given in my above response using SharePoint JSON formatting. Let us know if it works for you.
Please consider giving a Like if my post helped you in any way.
- Mel_C13Brass ContributorI have been using this JSON for months now and it was working great. But now, even though the promoted state says 0 and we have unpublished the page, the pages are still showing up in the news webpart. It seems that the only way for us to get them to go away is to delete them.
Does anyone have any suggestions?
- brewsaBrass ContributorThe column formatting solution above from @thechriskent (posted above by ganeshsanap) worked for me in a few seconds.
There is a SPFx extension created by Mikael Svenson for demoting news pages. You can use this extension for your requirements.
Sample code at: Demote News to page Command
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- M365061290Iron Contributor
Deleted
We can demote or unpromote news using following list view extension
- Deleted
If you want to use flow you can think of below
Use Create flow button from Site Pages library and choose template When a file is created or modified in a folder .
Use Get File Metadata using path action and select folder path as SitePages
Using Update file properties Update promotedState to zero from 2 and and it should update to SitePage.
- There are a couple ways: one option is to go to a "flat" view of the Site Pages library and use Quick Edit to change the promoted state value from 2 to 0. The other is to start with a flat view and make sure to show Promoted State. Then, group by Promoted State. You can drag a page from one group to another and that will change the promoted state.
- Deleted
Not sure what has happend but if i move the page from 0 to 2 i get a status of 200.000.000.000.000 On the same tenant different sitecollection the drag and drop works fine. Could some-one please tell me what i'm doing wrong?
Thanks in advanced.
Rgds,
Red Behari
- Deleted
Ok, I finally got this to work without Using flow. Do the following.
1.Go to Site Pages on your Site.
2.Change your view to "All Items"
3.Now Click the + to add a column to view, and select Show/Hide Columns
4.Check Promoted State column and click "Apply" at the top.
5.Now Click the view drop down and Save view as
6.Name it "All Items and State"
7.Now you should be able to click "Quick Edit" and then Promoted State column will be exposed to change the value. Change the page you no longer want to be news from 2 to 0 and Click exit and your page can now be a Site page again.- M365SpecialistBrass ContributorThat doesn't work for me in SharePoint in Microsoft 365 because the Promoted State is 'read-only', even when editing in grid view. Some time ago, found a json code to put on the Promoted State column. It allows you to change the promoted state from 2 to 1 or 0, but doesn't let you go the other way. I hope it helps you and sorry I don't have the name of the original author. A box of Krispy Kream donuts for anyone who can tell me how to make it go the other way too. 🙂
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"flex-wrap": "wrap",
"display": "flex",
"flex-direction": "row"
},
"children": [
{
"elmType": "div",
"txtContent": "=if(@currentField == 0 ,'0 : Page' , if(@currentField == 1, '1 : News (Unpublished)' , if(@currentField == 2 , '2 : News','') ) )",
"style": {
"box-sizing": "border-box",
"padding": "4px 8px 5px 8px",
"display": "flex",
"border-radius": "16px",
"height": "27px",
"align-items": "center",
"white-space": "nowrap",
"overflow": "hidden",
"margin": "4px 4px 4px 4px",
"border": "1px solid"
},
"attributes": {
"class": "=if(@currentField == 0 ,'ms-fontColor-themePrimary ms-borderColor-themePrimary ms-bgColor-white' , if(@currentField == 1, 'ms-fontColor-themePrimary ms-borderColor-themePrimary ms-bgColor-themeLighter' , if(@currentField == 2 , 'ms-fontColor-white ms-borderColor-themePrimary ms-bgColor-themePrimary','') ) )"
}
},
{
"elmType": "div",
"style": {
"font-size": "18px",
"cursor": "pointer",
"padding": "10px",
"border-radius": "50%",
"display": "=if(@currentField == 0 , 'none' ,'')"
},
"attributes": {
"iconName": "MoreVertical",
"class": "ms-fontColor-themePrimary ms-bgColor-themeLighter--hover"
},
"customCardProps": {
"openOnEvent": "click",
"directionalHint": "rightCenter",
"isBeakVisible": true,
"formatter": {
"elmType": "div",
"txtContent": "Demote (Change to 0:Page)",
"style": {
"padding": "10px 20px 10px 20px",
"cursor": "pointer"
},
"attributes": {
"class": "ms-bgColor-themeLighter--hover"
},
"customRowAction": {
"action": "setValue",
"actionInput": {
"PromotedState": "0"
}
}
}
}
}
]
} - CLHessCopper Contributor
I tried this by when I try to change 2 to 0, it says cell is "read only"... I am a site owner. Any suggestions?
- carlosxjuniorCopper Contributor
I dont't get this Quick Edit option, only "Edit in grid view" and then it says the cell for Promoted State is read only, so I can't change it. Any ideas on what I should do?
- RobElliottSilver Contributor
carlosxjunior you can see my post on how to change the promoted state at https://techcommunity.microsoft.com/t5/sharepoint/sharepoint-news-post-still-appears-even-after-the-news-page-has/m-p/3291560/highlight/true#M59373
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)