C# Класс Microsoft.SharePoint.Client.PageExtensions

Class that handles all page and web part related operations
Показать файл Открыть проект

Открытые методы

Метод Описание
AddHtmlToWikiPage ( this web, string serverRelativePageUrl, string html ) : void

Add HTML to a wiki page

AddHtmlToWikiPage ( this web, string folder, string html, string page ) : void

Add html to a wiki style page

AddHtmlToWikiPage ( this web, string folder, string html, string page, int row, int col ) : void

Add a HTML fragment to a location on a wiki style page

AddLayoutToWikiPage ( this web, WikiPageLayout layout, string serverRelativePageUrl ) : void

Applies a layout to a wiki page

AddLayoutToWikiPage ( this web, string folder, WikiPageLayout layout, string page ) : void

Applies a layout to a wiki page

AddNavigationFriendlyUrl ( this page, Web web, string navigationTitle, string friendlyUrlSegment, NavigationTermSetItem editableParent, bool showInGlobalNavigation = true, bool showInCurrentNavigation = true ) : string

Adds a user-friendly URL for a PublishingPage object.

AddPublishingPage ( this web, string pageName, string pageTemplateName, string title = null, bool publish = false, Folder folder = null, System.DateTime startDate = null, System.DateTime endDate = null, System.Boolean schedule = false ) : void

Adds the publishing page.

AddWebPartToWebPartPage ( this web, OfficeDevPnP.Core.Entities.WebPartEntity webPart, string page ) : WebPartDefinition

Inserts a web part on a web part page

AddWebPartToWebPartPage ( this web, string serverRelativePageUrl, OfficeDevPnP.Core.Entities.WebPartEntity webPart ) : WebPartDefinition

Inserts a web part on a web part page

AddWebPartToWikiPage ( this web, string folder, OfficeDevPnP.Core.Entities.WebPartEntity webPart, string page, int row, int col, bool addSpace ) : WebPartDefinition

Add web part to a wiki style page

AddWikiPage ( this web, string wikiPageLibraryName, string wikiPageName ) : string

Adds a blank Wiki page to the site pages library

AddWikiPageByUrl ( this web, string serverRelativePageUrl, string html = null ) : void

Adds a wiki page by Url

DeleteWebPart ( this web, string serverRelativePageUrl, string title ) : void

Deletes a web part from a page

DeleteWebPart ( this web, string folder, string title, string page ) : void

Deletes a web part from a page

EnsureWikiPage ( this web, string wikiPageLibraryName, string wikiPageName ) : string

Returns the Url for the requested wiki page, creates it if the pageis not yet available

GetPublishingPage ( this web, string fileLeafRef ) : PublishingPage

Gets a Publishing Page from the root folder of the Pages library.

GetPublishingPage ( this web, string fileLeafRef, Folder folder ) : PublishingPage

Gets a Publishing Page from any folder in the Pages library.

GetWebPartProperties ( this web, System.Guid id, string serverRelativePageUrl ) : PropertyValues

Returns web part properties

GetWebPartXml ( this web, System.Guid webPartId, string serverRelativePageUrl ) : string
GetWebParts ( this web, string serverRelativePageUrl ) : IEnumerable

List the web parts on a page

GetWikiPageContent ( this web, string serverRelativePageUrl ) : string

Returns the HTML contents of a wiki page

SetWebPartProperty ( this web, string key, bool value, System.Guid id, string serverRelativePageUrl ) : void

Sets a web part property

SetWebPartProperty ( this web, string key, int value, System.Guid id, string serverRelativePageUrl ) : void

Sets a web part property

SetWebPartProperty ( this web, string key, string value, System.Guid id, string serverRelativePageUrl ) : void

Sets a web part property

Приватные методы

Метод Описание
AddHtmlToWikiPage ( this web, string serverRelativePageUrl, string html, int row, int col ) : void
AddWebPart ( File webPartPage, OfficeDevPnP.Core.Entities.WebPartEntity webPart, string zoneId, int zoneIndex ) : WebPartDefinition
AddWebPartToWikiPage ( this web, string serverRelativePageUrl, OfficeDevPnP.Core.Entities.WebPartEntity webPart, int row, int col, bool addSpace ) : WebPartDefinition
SetWebPartPropertyInternal ( this web, string key, object value, System.Guid id, string serverRelativePageUrl ) : void
WikiPageImplementation ( Web web, string wikiPageLibraryName, string wikiPageName, string &wikiPageUrl, List &pageLibrary, string &newWikiPageUrl, File &currentPageFile, string &pathAndQuery ) : void

Описание методов

AddHtmlToWikiPage() публичный статический Метод

Add HTML to a wiki page
Thrown when serverRelativePageUrl or html is a zero-length string or contains only white space Thrown when serverRelativePageUrl or html is null
public static AddHtmlToWikiPage ( this web, string serverRelativePageUrl, string html ) : void
web this Site to be processed - can be root web or sub site
serverRelativePageUrl string
html string
Результат void

AddHtmlToWikiPage() публичный статический Метод

Add html to a wiki style page
Thrown when folder, html or page is a zero-length string or contains only white space Thrown when folder, html or page is null
public static AddHtmlToWikiPage ( this web, string folder, string html, string page ) : void
web this Site to be processed - can be root web or sub site
folder string System name of the wiki page library - typically sitepages
html string The html to insert
page string Page to add the html on
Результат void

AddHtmlToWikiPage() публичный статический Метод

Add a HTML fragment to a location on a wiki style page
Thrown when folder, html or page is a zero-length string or contains only white space Thrown when folder, html or page is null
public static AddHtmlToWikiPage ( this web, string folder, string html, string page, int row, int col ) : void
web this Site to be processed - can be root web or sub site
folder string System name of the wiki page library - typically sitepages
html string html to be inserted
page string Page to add the web part on
row int Row of the wiki table that should hold the inserted web part
col int Column of the wiki table that should hold the inserted web part
Результат void

AddLayoutToWikiPage() публичный статический Метод

Applies a layout to a wiki page
Thrown when serverRelativePageUrl is a zero-length string or contains only white space Thrown when serverRelativePageUrl is null
public static AddLayoutToWikiPage ( this web, WikiPageLayout layout, string serverRelativePageUrl ) : void
web this Site to be processed - can be root web or sub site
layout WikiPageLayout Wiki page layout to be applied
serverRelativePageUrl string
Результат void

AddLayoutToWikiPage() публичный статический Метод

Applies a layout to a wiki page
Thrown when folder or page is a zero-length string or contains only white space Thrown when folder or page is null
public static AddLayoutToWikiPage ( this web, string folder, WikiPageLayout layout, string page ) : void
web this Site to be processed - can be root web or sub site
folder string System name of the wiki page library - typically sitepages
layout WikiPageLayout Wiki page layout to be applied
page string Name of the page that will get a new wiki page layout
Результат void

AddNavigationFriendlyUrl() публичный статический Метод

Adds a user-friendly URL for a PublishingPage object.
public static AddNavigationFriendlyUrl ( this page, Web web, string navigationTitle, string friendlyUrlSegment, NavigationTermSetItem editableParent, bool showInGlobalNavigation = true, bool showInCurrentNavigation = true ) : string
page this The target page to add to managed navigation.
web Web The target web.
navigationTitle string The title for the navigation item.
friendlyUrlSegment string The user-friendly text to use as the URL segment.
editableParent NavigationTermSetItem The parent NavigationTermSetItem object below which this new friendly URL should be created.
showInGlobalNavigation bool Defines whether the navigation item has to be shown in the Global Navigation, optional and default to true.
showInCurrentNavigation bool Defines whether the navigation item has to be shown in the Current Navigation, optional and default to true.
Результат string

AddPublishingPage() публичный статический Метод

Adds the publishing page.
Thrown when key or pageName is a zero-length string or contains only white space Thrown when key or pageName is null
public static AddPublishingPage ( this web, string pageName, string pageTemplateName, string title = null, bool publish = false, Folder folder = null, System.DateTime startDate = null, System.DateTime endDate = null, System.Boolean schedule = false ) : void
web this The web.
pageName string Name of the page.
pageTemplateName string Name of the page template/layout excluded the .aspx file extension.
title string The title of the target publishing page.
publish bool Should the page be published or not?
folder Folder The target folder for the page, within the Pages library.
startDate System.DateTime Start date for scheduled publishing.
endDate System.DateTime End date for scheduled publishing.
schedule System.Boolean Defines whether to define a schedule or not.
Результат void

AddWebPartToWebPartPage() публичный статический Метод

Inserts a web part on a web part page
Thrown when page is a zero-length string or contains only white space Thrown when webPart or page is null
public static AddWebPartToWebPartPage ( this web, OfficeDevPnP.Core.Entities.WebPartEntity webPart, string page ) : WebPartDefinition
web this Site to be processed - can be root web or sub site
webPart OfficeDevPnP.Core.Entities.WebPartEntity Information about the web part to insert
page string Page to add the web part on
Результат WebPartDefinition

AddWebPartToWebPartPage() публичный статический Метод

Inserts a web part on a web part page
Thrown when serverRelativePageUrl is a zero-length string or contains only white space Thrown when serverRelativePageUrl or webPart is null
public static AddWebPartToWebPartPage ( this web, string serverRelativePageUrl, OfficeDevPnP.Core.Entities.WebPartEntity webPart ) : WebPartDefinition
web this Site to be processed - can be root web or sub site
serverRelativePageUrl string Page to add the web part on
webPart OfficeDevPnP.Core.Entities.WebPartEntity Information about the web part to insert
Результат WebPartDefinition

AddWebPartToWikiPage() публичный статический Метод

Add web part to a wiki style page
Thrown when folder or page is a zero-length string or contains only white space Thrown when folder, webPart or page is null
public static AddWebPartToWikiPage ( this web, string folder, OfficeDevPnP.Core.Entities.WebPartEntity webPart, string page, int row, int col, bool addSpace ) : WebPartDefinition
web this Site to be processed - can be root web or sub site
folder string System name of the wiki page library - typically sitepages
webPart OfficeDevPnP.Core.Entities.WebPartEntity Information about the web part to insert
page string Page to add the web part on
row int Row of the wiki table that should hold the inserted web part
col int Column of the wiki table that should hold the inserted web part
addSpace bool Does a blank line need to be added after the web part (to space web parts)
Результат WebPartDefinition

AddWikiPage() публичный статический Метод

Adds a blank Wiki page to the site pages library
Thrown when wikiPageLibraryName or wikiPageName is a zero-length string or contains only white space Thrown when wikiPageLibraryName or wikiPageName is null
public static AddWikiPage ( this web, string wikiPageLibraryName, string wikiPageName ) : string
web this Site to be processed - can be root web or sub site
wikiPageLibraryName string Name of the wiki page library
wikiPageName string Wiki page to operate on
Результат string

AddWikiPageByUrl() публичный статический Метод

Adds a wiki page by Url
Thrown when serverRelativePageUrl is a zero-length string or contains only white space Thrown when serverRelativePageUrl is null
public static AddWikiPageByUrl ( this web, string serverRelativePageUrl, string html = null ) : void
web this The web to process
serverRelativePageUrl string Server relative URL of the wiki page to process
html string HTML to add to wiki page
Результат void

DeleteWebPart() публичный статический Метод

Deletes a web part from a page
Thrown when serverRelativePageUrl or title is a zero-length string or contains only white space Thrown when serverRelativePageUrl or title is null
public static DeleteWebPart ( this web, string serverRelativePageUrl, string title ) : void
web this Site to be processed - can be root web or sub site
serverRelativePageUrl string Server relative URL of the page to remove
title string Title of the web part that needs to be deleted
Результат void

DeleteWebPart() публичный статический Метод

Deletes a web part from a page
Thrown when folder, title or page is a zero-length string or contains only white space Thrown when folder, title or page is null
public static DeleteWebPart ( this web, string folder, string title, string page ) : void
web this Site to be processed - can be root web or sub site
folder string System name of the wiki page library - typically sitepages
title string Title of the web part that needs to be deleted
page string Page to remove the web part from
Результат void

EnsureWikiPage() публичный статический Метод

Returns the Url for the requested wiki page, creates it if the pageis not yet available
Thrown when wikiPageLibraryName or wikiPageName is a zero-length string or contains only white space Thrown when wikiPageLibraryName or wikiPageName is null
public static EnsureWikiPage ( this web, string wikiPageLibraryName, string wikiPageName ) : string
web this Site to be processed - can be root web or sub site
wikiPageLibraryName string Name of the wiki page library
wikiPageName string Wiki page to operate on
Результат string

GetPublishingPage() публичный статический Метод

Gets a Publishing Page from the root folder of the Pages library.
fileLeafRef fileLeafRef
public static GetPublishingPage ( this web, string fileLeafRef ) : PublishingPage
web this The web.
fileLeafRef string The file leaf reference.
Результат PublishingPage

GetPublishingPage() публичный статический Метод

Gets a Publishing Page from any folder in the Pages library.
fileLeafRef fileLeafRef
public static GetPublishingPage ( this web, string fileLeafRef, Folder folder ) : PublishingPage
web this The web.
fileLeafRef string The file leaf reference.
folder Folder The folder where to search the page.
Результат PublishingPage

GetWebPartProperties() публичный статический Метод

Returns web part properties
Thrown when key or serverRelativePageUrl is a zero-length string or contains only white space Thrown when key or serverRelativePageUrl is null
public static GetWebPartProperties ( this web, System.Guid id, string serverRelativePageUrl ) : PropertyValues
web this The web to process
id System.Guid The id of the webpart
serverRelativePageUrl string
Результат PropertyValues

GetWebPartXml() публичный статический Метод

public static GetWebPartXml ( this web, System.Guid webPartId, string serverRelativePageUrl ) : string
web this
webPartId System.Guid
serverRelativePageUrl string
Результат string

GetWebParts() публичный статический Метод

List the web parts on a page
Thrown when serverRelativePageUrl is a zero-length string or contains only white space Thrown when serverRelativePageUrl is null
public static GetWebParts ( this web, string serverRelativePageUrl ) : IEnumerable
web this Site to be processed - can be root web or sub site
serverRelativePageUrl string Server relative url of the page containing the webparts
Результат IEnumerable

GetWikiPageContent() публичный статический Метод

Returns the HTML contents of a wiki page
Thrown when serverRelativePageUrl is a zero-length string or contains only white space Thrown when serverRelativePageUrl is null
public static GetWikiPageContent ( this web, string serverRelativePageUrl ) : string
web this Site to be processed - can be root web or sub site
serverRelativePageUrl string Server relative url of the page, e.g. /sites/demo/SitePages/Test.aspx
Результат string

SetWebPartProperty() публичный статический Метод

Sets a web part property
Thrown when key or serverRelativePageUrl is a zero-length string or contains only white space Thrown when key or serverRelativePageUrl is null
public static SetWebPartProperty ( this web, string key, bool value, System.Guid id, string serverRelativePageUrl ) : void
web this The web to process
key string The key to update
value bool The value to set
id System.Guid The id of the webpart
serverRelativePageUrl string
Результат void

SetWebPartProperty() публичный статический Метод

Sets a web part property
Thrown when key or serverRelativePageUrl is a zero-length string or contains only white space Thrown when key or serverRelativePageUrl is null
public static SetWebPartProperty ( this web, string key, int value, System.Guid id, string serverRelativePageUrl ) : void
web this The web to process
key string The key to update
value int The value to set
id System.Guid The id of the webpart
serverRelativePageUrl string
Результат void

SetWebPartProperty() публичный статический Метод

Sets a web part property
Thrown when key or serverRelativePageUrl is a zero-length string or contains only white space Thrown when key or serverRelativePageUrl is null
public static SetWebPartProperty ( this web, string key, string value, System.Guid id, string serverRelativePageUrl ) : void
web this The web to process
key string The key to update
value string The value to set
id System.Guid The id of the webpart
serverRelativePageUrl string
Результат void