Provisionando una Modern News Page desde código

Luis Mañez
Feb 26, 2017 · 1 min read
Image for post
Image for post

En la próxima release de Marzo del PnP, el equipo nos ha confirmado que tendremos una Extension para crear Modern Pages desde código. De hecho, parte de ese código ya podemos verlo en este artículo:

Pues bien, si le damos una vuelta más al código, podemos crear “Modern News pages”. El siguiente snippet me ha funcionado en mis pruebas, y supongo que en breve tendremos algo parecido en el propio PnP:

El código es muy similar al del artículo, pero ponemos el “PromotedState” al valor: 2

item["PromotedState"] = "2";

y luego, es muy importante establecer el campo “FirstPublishedDate” ya que de no hacerlo, el artículo aparecerá en último lugar en el listado de News, y no estara visible en el webpart de News.

item["FirstPublishedDate"] = DateTime.Now;

Espero que os sirva!

Luis Mañez

Inherits Cloud

Office Development MVP.

Luis Mañez

Written by

Office Development MVP. SharePoint and Cloud Solutions architect. MS Azure certified developer and MCPD SharePoint 2010

Inherits Cloud

Office Development MVP. Loving Microsoft cloud, specially Office 365. Here you can find articles about Microsoft Cloud, always from a development point of view, and specially focus on SharePoint Online.

Luis Mañez

Written by

Office Development MVP. SharePoint and Cloud Solutions architect. MS Azure certified developer and MCPD SharePoint 2010

Inherits Cloud

Office Development MVP. Loving Microsoft cloud, specially Office 365. Here you can find articles about Microsoft Cloud, always from a development point of view, and specially focus on SharePoint Online.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store