Interface IPage
A modern SharePoint Page
Namespace: PnP.Core.Model.SharePoint
Assembly: PnP.Core.dll
Syntax
public interface IPage
A modern SharePoint Page
public interface IPage
List of control on this page
List<ICanvasControl> Controls { get; }
PnP.Core.Model.SharePoint.List<ICanvasControl>
|
The default section of the client side page
ICanvasSection DefaultSection { get; }
ICanvasSection
|
Returns the editor that was used to create/update this page
EditorType EditorType { get; }
EditorType
|
Entity id field for topic pages
string EntityId { get; set; }
System.String
|
Entity relations field for topic pages
string EntityRelations { get; set; }
System.String
|
Entity type field for topic pages
string EntityType { get; set; }
System.String
|
Folder the page lives in (available after saving the page)
string Folder { get; }
System.String
|
List of controls on this page's header
List<ICanvasControl> HeaderControls { get; }
PnP.Core.Model.SharePoint.List<ICanvasControl>
|
When a page of type Home is created you can opt to only keep the default client side web parts by setting this to true. This also is a way to reset your home page back the the stock one.
bool KeepDefaultWebParts { get; set; }
System.Boolean
|
Layout type of the client side page
PageLayoutType LayoutType { get; set; }
PageLayoutType
|
The name of this page (available after saving the page)
string Name { get; }
System.String
|
Returns the page header for this page
IPageHeader PageHeader { get; }
IPageHeader
|
ID value of the page (only available when the page was saved)
int? PageId { get; }
System.Nullable<System.Int32>
|
Title of the client side page
string PageTitle { get; set; }
System.String
|
Description of the repost page
string RepostDescription { get; set; }
System.String
|
Id of the SharePoint IListItem connected to the page being reposted
Guid RepostSourceItemId { get; set; }
Guid
|
Id of the SharePoint IList containting the page being reposted
Guid RepostSourceListId { get; set; }
Guid
|
Id of the SharePoint ISite containting the page being reposted
Guid RepostSourceSiteId { get; set; }
Guid
|
Url being reposted using the repost page
string RepostSourceUrl { get; set; }
System.String
|
Id of the SharePoint IWeb containting the page being reposted
Guid RepostSourceWebId { get; set; }
Guid
|
Returns the scheduled publish data of a page (only if publish was scheduled)
DateTime? ScheduledPublishDate { get; }
System.Nullable<DateTime>
|
List of sections on this page
List<ICanvasSection> Sections { get; }
PnP.Core.Model.SharePoint.List<ICanvasSection>
|
Space content field (JSON) for spaces pages
string SpaceContent { get; set; }
System.String
|
Thumbnail url for the page
string ThumbnailUrl { get; set; }
System.String
|
Adds a new control to your client side page using the default ICanvasSection
void AddControl(ICanvasControl control)
ICanvasControl
control
ICanvasControl to add |
Adds a new control to your client side page in the given section
void AddControl(ICanvasControl control, ICanvasColumn column)
ICanvasControl
control
ICanvasControl to add |
ICanvasColumn
column
ICanvasColumn that will hold the control |
Adds a new control to your client side page in the given section with a given order
void AddControl(ICanvasControl control, ICanvasColumn column, int order)
ICanvasControl
control
ICanvasControl to add |
ICanvasColumn
column
ICanvasColumn that will hold the control |
System.Int32
order
Order of the control in the given section |
Adds a new control to your client side page in the given section
void AddControl(ICanvasControl control, ICanvasSection section)
ICanvasControl
control
ICanvasControl to add |
ICanvasSection
section
ICanvasSection that will hold the control. Control will end up in the DefaultColumn. |
Adds a new control to your client side page in the given section with a given order
void AddControl(ICanvasControl control, ICanvasSection section, int order)
ICanvasControl
control
ICanvasControl to add |
ICanvasSection
section
ICanvasSection that will hold the control. Control will end up in the DefaultColumn. |
System.Int32
order
Order of the control in the given section |
Adds a new control to your client side page using the default ICanvasSection using a given order
void AddControl(ICanvasControl control, int order)
ICanvasControl
control
ICanvasControl to add |
System.Int32
order
Order of the control in the default section |
Adds a new header control to your client side page with a given order. Used for topic page creation
void AddHeaderControl(ICanvasControl control, int order)
ICanvasControl
control
ICanvasControl to add |
System.Int32
order
Order of the control in the given section |
Adds a new section to your client side page
void AddSection(CanvasSectionTemplate sectionTemplate, float order)
CanvasSectionTemplate
sectionTemplate
The CanvasSectionTemplate type of the section |
System.Single
order
Controls the order of the new section |
Adds a new section to your client side page
void AddSection(CanvasSectionTemplate sectionTemplate, float order, VariantThemeType zoneEmphasis, VariantThemeType verticalSectionZoneEmphasis = default(VariantThemeType))
CanvasSectionTemplate
sectionTemplate
The CanvasSectionTemplate type of the section |
System.Single
order
Controls the order of the new section |
VariantThemeType
zoneEmphasis
Zone emphasis (section background) |
VariantThemeType
verticalSectionZoneEmphasis
Vertical Section Zone emphasis (section background) |
Adds a new section to your client side page
void AddSection(CanvasSectionTemplate sectionTemplate, float order, int zoneEmphasis, int? verticalSectionZoneEmphasis = null)
CanvasSectionTemplate
sectionTemplate
The CanvasSectionTemplate type of the section |
System.Single
order
Controls the order of the new section |
System.Int32
zoneEmphasis
Zone emphasis (section background) |
System.Nullable<System.Int32>
verticalSectionZoneEmphasis
Vertical Section Zone emphasis (section background) |
Adds a new section to your client side page
void AddSection(ICanvasSection section)
ICanvasSection
section
ICanvasSection object describing the section to add |
Adds a new section to your client side page with a given order
void AddSection(ICanvasSection section, float order)
ICanvasSection
section
ICanvasSection object describing the section to add |
System.Single
order
Controls the order of the new section |
Does this page have comments disabled
bool AreCommentsDisabled()
System.Boolean
|
Does this page have comments disabled
Task<bool> AreCommentsDisabledAsync()
Task<System.Boolean>
|
Gets a list of available client side web parts to use, optionally filtered by a given name
IEnumerable<IPageComponent> AvailablePageComponents(string name = null)
System.String
name
Name of the web part to retrieve |
IEnumerable<IPageComponent>
List of available IPageComponent |
Gets a list of available client side web parts to use, optionally filtered by a given name
Task<IEnumerable<IPageComponent>> AvailablePageComponentsAsync(string name = null)
System.String
name
Name of the web part to retrieve |
Task<IEnumerable<IPageComponent>>
List of available IPageComponent |
Clears the sections and controls from the page
void ClearPage()
Translates a given DefaultWebPart enum to it's corresponding web part id. Non default web parts will be returned as empty string
string DefaultWebPartToWebPartId(DefaultWebPart webPart)
DefaultWebPart
webPart
DefaultWebPart enum to translate to it's id |
System.String
The corresponding web part id |
Deletes the created page
void Delete()
Deletes the created page
Task DeleteAsync()
Task
|
Demotes an client side Article news page as a regular client side page
void DemoteNewsArticle()
Demotes an client side Article news page as a regular client side page
Task DemoteNewsArticleAsync()
Task
|
Disable commenting on this page
void DisableComments()
Disable commenting on this page
Task DisableCommentsAsync()
Task
|
Enable commenting on this page
void EnableComments()
Enable commenting on this page
Task EnableCommentsAsync()
Task
|
Get list item comments
ICommentCollection GetComments(params Expression<Func<IComment, object>>[] selectors)
Expression<Func<IComment, System.Object>>[]
selectors
The expressions declaring the fields to select |
ICommentCollection
|
Get list item comments
Task<ICommentCollection> GetCommentsAsync(params Expression<Func<IComment, object>>[] selectors)
Expression<Func<IComment, System.Object>>[]
selectors
The expressions declaring the fields to select |
Task<ICommentCollection>
|
Prepares an Image web part for adding to a page
IPageWebPart GetImageWebPart(string serverRelativeUrl, PageImageOptions imageOptions = null)
System.String
serverRelativeUrl
Server relative url of the image to show in the image web part |
PageImageOptions
imageOptions
Options to configure the image when being added |
IPageWebPart
Configured image web part which can be added to the page |
Prepares an Image web part for adding to a page
Task<IPageWebPart> GetImageWebPartAsync(string serverRelativeUrl, PageImageOptions imageOptions = null)
System.String
serverRelativeUrl
Server relative url of the image to show in the image web part |
PageImageOptions
imageOptions
Options to configure the image when being added |
Task<IPageWebPart>
Configured image web part which can be added to the page |
Prepares an inline image for adding to text by adding the needed image web part and returning the HTML snippet that needs to be appended to the text editor content
string GetInlineImage(IPageText textEditorInstance, string serverRelativeUrl, PageImageOptions imageOptions = null)
IPageText
textEditorInstance
Text editor instance to add the inline image to |
System.String
serverRelativeUrl
Server relative url of the image to add inline |
PageImageOptions
imageOptions
Options to configure the inline image when being added |
System.String
Html snippet to be appended to the text editor content |
Prepares an inline image for adding to text by adding the needed image web part and returning the HTML snippet that needs to be appended to the text editor content
Task<string> GetInlineImageAsync(IPageText textEditorInstance, string serverRelativeUrl, PageImageOptions imageOptions = null)
IPageText
textEditorInstance
Text editor instance to add the inline image to, when the PnP.Core.Model.SharePoint.Page.EditorType is CK5 then this can be left null |
System.String
serverRelativeUrl
Server relative url of the image to add inline |
PageImageOptions
imageOptions
Options to configure the inline image when being added |
Task<System.String>
Html snippet to be appended to the text editor content |
Returns information about the likes on this page
ILikedByInformation GetLikedByInformation()
ILikedByInformation
|
Returns information about the likes on this page
Task<ILikedByInformation> GetLikedByInformationAsync()
Task<ILikedByInformation>
|
Gets the file connected to this page
IFile GetPageFile(params Expression<Func<IFile, object>>[] expressions)
Expression<Func<IFile, System.Object>>[]
expressions
Properties to load for the file |
IFile
The connected IFile |
Gets the file connected to this page
Task<IFile> GetPageFileAsync(params Expression<Func<IFile, object>>[] expressions)
Expression<Func<IFile, System.Object>>[]
expressions
Properties to load for the file |
Task<IFile>
The connected IFile |
Returns the page translation status for a given page
IPageTranslationStatusCollection GetPageTranslations()
IPageTranslationStatusCollection
IPageTranslationStatusCollection list containing information about this page's translations |
Returns the page translation status for a given page
Task<IPageTranslationStatusCollection> GetPageTranslationsAsync()
Task<IPageTranslationStatusCollection>
IPageTranslationStatusCollection list containing information about this page's translations |
Returns the name of the templates folder, and creates if it doesn't exist.
string GetTemplatesFolder()
System.String
|
Returns the name of the templates folder, and creates if it doesn't exist.
Task<string> GetTemplatesFolderAsync()
Task<System.String>
|
Instantiates a new web part with default data and returns it
IPageWebPart InstantiateDefaultWebPart(DefaultWebPart webPart)
DefaultWebPart
webPart
Default web part to instantiate |
IPageWebPart
Instantiated web part |
Instantiates a new web part with default data and returns it
Task<IPageWebPart> InstantiateDefaultWebPartAsync(DefaultWebPart webPart)
DefaultWebPart
webPart
Default web part to instantiate |
Task<IPageWebPart>
Instantiated web part |
Likes a page
void Like()
Likes a page
Task LikeAsync()
Task
|
Creates a new text part which can be configured and added to the page
IPageText NewTextPart(string text = null)
System.String
text
Optionally provide the text for the text part |
IPageText
The created text part |
Creates a new web part
IPageWebPart NewWebPart(IPageComponent clientSideComponent = null)
IPageComponent
clientSideComponent
The base component to use for this web part |
IPageWebPart
The created web part |
Sets the current IPage as home page for the current site
Task PromoteAsHomePageAsync()
Task
|
Promotes a regular Article client side page as a news page
Task PromoteAsNewsArticleAsync()
Task
|
Publishes a client side page
void Publish(string comment = null)
System.String
comment
Publishing comment |
Publishes a client side page
Task PublishAsync(string comment = null)
System.String
comment
Publishing comment |
Task
|
Removes the set page header by setting the page banner web part to "Plain" mode
void RemovePageHeader()
Removes the publication schedule of a client side page
void RemoveSchedulePublish()
Removes the publication schedule of a client side page
Task RemoveSchedulePublishAsync()
Task
|
Saves the page to the pages library
string Save(string pageName = null)
System.String
pageName
Page name to use |
System.String
The name of the saved page |
Saves the page as a template page
string SaveAsTemplate(string pageName = null)
System.String
pageName
Page name to use |
System.String
The name of the saved page |
Saves the page as a template page
Task<string> SaveAsTemplateAsync(string pageName = null)
System.String
pageName
Page name to use |
Task<System.String>
The name of the saved page |
Saves the page to the pages library
Task<string> SaveAsync(string pageName = null)
System.String
pageName
Page name to use |
Task<System.String>
The name of the saved page |
Schedules the publication of a client side page
void SchedulePublish(DateTime publishDate)
DateTime
publishDate
Date when the page needs to be publishing |
Schedules the publication of a client side page
Task SchedulePublishAsync(DateTime publishDate)
DateTime
publishDate
Date when the page needs to be publishing |
Task
|
Sets page header with custom focal point
void SetCustomPageHeader(string serverRelativeImageUrl, double? translateX = null, double? translateY = null)
System.String
serverRelativeImageUrl
Server relative page header image url |
System.Nullable<System.Double>
translateX
X focal point for image |
System.Nullable<System.Double>
translateY
Y focal point for image |
Sets page header back to the default page header
void SetDefaultPageHeader()
Sets page header back to the default for PageTilte WebPart (Message ID: MC791596 / Roadmap ID: 386904). The PageTitle WebPart has to be added into a first OneColumnFullWith Section separate.
void SetPageTitleWebPartPageHeader()
Creates page translations for all the languages defined as multi-lingual languages in the site
IPageTranslationStatusCollection TranslatePages()
IPageTranslationStatusCollection
IPageTranslationStatusCollection list containing information about this page's translations |
Creates page translations for the requested languages
IPageTranslationStatusCollection TranslatePages(PageTranslationOptions pageTranslationOptions)
PageTranslationOptions
pageTranslationOptions
Options describing the languages in which a translation needs to be created |
IPageTranslationStatusCollection
IPageTranslationStatusCollection list containing information about this page's translations |
Creates page translations for all the languages defined as multi-lingual languages in the site
Task<IPageTranslationStatusCollection> TranslatePagesAsync()
Task<IPageTranslationStatusCollection>
IPageTranslationStatusCollection list containing information about this page's translations |
Creates page translations for the requested languages
Task<IPageTranslationStatusCollection> TranslatePagesAsync(PageTranslationOptions pageTranslationOptions)
PageTranslationOptions
pageTranslationOptions
Options describing the languages in which a translation needs to be created |
Task<IPageTranslationStatusCollection>
IPageTranslationStatusCollection list containing information about this page's translations |
Unlikes a page
void Unlike()
Unlikes a page
Task UnlikeAsync()
Task
|
Translated a given web part id to a DefaultWebPart enum. Non default web parts will be returned as ThirdParty
DefaultWebPart WebPartIdToDefaultWebPart(string id)
System.String
id
Web part id to lookup |
DefaultWebPart
Corresponding DefaultWebPart enum value |