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

Class that deals with site (both site collection and web site) creation, status, retrieval and settings
Показать файл Открыть проект

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

Метод Описание
AddIndexedPropertyBagKey ( this web, string key ) : bool

Marks a property bag key for indexing

AddRemoteEventReceiver ( this web, string name, string url, EventReceiverType eventReceiverType, EventReceiverSynchronization synchronization, bool force ) : EventReceiverDefinition

Registers a remote event receiver

AddRemoteEventReceiver ( this web, string name, string url, EventReceiverType eventReceiverType, EventReceiverSynchronization synchronization, int sequenceNumber, bool force ) : EventReceiverDefinition

Registers a remote event receiver

ApplyProvisioningTemplate ( this web, OfficeDevPnP.Core.Framework.Provisioning.Model.ProvisioningTemplate template, OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ProvisioningTemplateApplyingInformation applyingInformation = null ) : void

Can be used to apply custom remote provisioning template on top of existing site.

CreateWeb ( this parentWeb, OfficeDevPnP.Core.Entities.SiteEntity subsite, bool inheritPermissions = true, bool inheritNavigation = true ) : Web

Adds a new child Web (site) to a parent Web.

CreateWeb ( this parentWeb, string title, string leafUrl, string description, string template, int language, bool inheritPermissions = true, bool inheritNavigation = true ) : Web

Adds a new child Web (site) to a parent Web.

DisableRequestAccess ( this web ) : void

Disables the request access on the web.

EnableRequestAccess ( this web ) : void

Enables request access for the specified e-mail addresses.

EnableRequestAccess ( this web, IEnumerable emails ) : void

Enables request access for the specified e-mail addresses.

GetAllWebUrls ( this site ) : IEnumerable

Gets the collection of the URLs of all Web sites that are contained within the site collection, including the top-level site and its subsites.

This is analagous to the SPSite.AllWebs property and can be used to get a collection of all web site URLs to loop through, e.g. for branding.

GetAppInstances ( this web ) : ClientObjectList

Returns all app instances

GetBaseTemplateId ( this parentWeb ) : String

Returns the Base Template ID for the current web

GetEventReceiverById ( this web, Guid id ) : EventReceiverDefinition

Returns an event receiver definition

GetEventReceiverByName ( this web, string name ) : EventReceiverDefinition

Returns an event receiver definition

GetIndexedPropertyBagKeys ( this web ) : IEnumerable

Returns all keys in the property bag that have been marked for indexing

GetPropertyBagValueDateTime ( this web, string key, DateTime defaultValue ) : DateTime?

Get DateTime typed property bag value. If does not contain, returns default value.

GetPropertyBagValueInt ( this web, string key, int defaultValue ) : int?

Get int typed property bag value. If does not contain, returns default value.

GetPropertyBagValueString ( this web, string key, string defaultValue ) : string

Get string typed property bag value. If does not contain, returns given default value.

GetProvisioningTemplate ( this web ) : ProvisioningTemplate

Can be used to extract custom provisioning template from existing site. The extracted template will be compared with the default base template.

GetProvisioningTemplate ( this web, ProvisioningTemplateCreationInformation creationInfo ) : ProvisioningTemplate

Can be used to extract custom provisioning template from existing site. The extracted template will be compared with the default base template.

GetRequestAccessEmails ( this web ) : IEnumerable

Gets the request access e-mail addresses of the web.

GetWeb ( this parentWeb, string leafUrl ) : Web

Returns the child Web site with the specified leaf URL.

The ServerRelativeUrl property of the retrieved Web is instantiated.

IsNoScriptSite ( this site ) : bool

Detects if the site in question has no script enabled or not. Detection is done by verifying if the AddAndCustomizePages permission is missing. See https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f for the effects of NoScript

IsPublishingWeb ( this web ) : bool
IsSubSite ( this web ) : bool

Checks if the current web is a sub site or not

PropertyBagContainsKey ( this web, string key ) : bool

Checks if the given property bag entry exists

ReIndexWeb ( this web ) : void

Queues a web for a full crawl the next incremental crawl

RemoveIndexedPropertyBagKey ( this web, string key ) : bool

Unmarks a property bag key for indexing

RemovePropertyBagValue ( this web, string key ) : void

Removes a property bag value from the property bag

SetLocalizationLabels ( this web, string cultureName, string titleResource, string descriptionResource ) : void

Can be used to set translations for different cultures.

SetPageOutputCache ( this web, bool enableOutputCache, int anonymousCacheProfileId, int authenticatedCacheProfileId, bool debugCacheInformation ) : void

Sets output cache on publishing web. The settings can be maintained from UI by visiting url /_layouts/15/sitecachesettings.aspx

SetPropertyBagValue ( this web, string key, DateTime value ) : void

Sets a key/value pair in the web property bag

SetPropertyBagValue ( this web, string key, int value ) : void

Sets a key/value pair in the web property bag

SetPropertyBagValue ( this web, string key, string value ) : void

Sets a key/value pair in the web property bag

SiteSearch ( this web ) : List

Returns all site collections that are indexed. In MT the search center, mysite host and contenttype hub are defined as non indexable by default and thus are not returned

SiteSearchScopedByTitle ( this web, string siteTitle ) : List

Returns all site collection that match with the provided title

SiteSearchScopedByUrl ( this web, string siteUrl ) : List

Returns all site collection that start with the provided URL

UninstallSolution ( this site, Guid packageGuid, string fileName, int majorVersion = 1, int minorVersion ) : void

Uninstalls a sandbox solution package (.WSP) file

WebExists ( this parentWeb, string leafUrl ) : bool

Determines if a child Web site with the specified leaf URL exists.

WebExistsByTitle ( this parentWeb, string title ) : bool

Determines if a web exists by title.

WebExistsFullUrl ( this context, string webFullUrl ) : bool

Determines if a Web (site) exists at the specified full URL, either accessible or that returns an access error.

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

Метод Описание
DeleteWeb ( this parentWeb, string leafUrl ) : bool
GetEncodedValueForSearchIndexProperty ( IEnumerable keys ) : string

Used to convert the list of property keys is required format for listing keys to be index

GetPropertyBagValueInternal ( Web web, string key ) : object

Type independent implementation of the property getter.

InstallSolution ( this site, Guid packageGuid, string sourceFilePath, int majorVersion = 1, int minorVersion ) : void
IsCannotGetSiteException ( Exception ex ) : bool
IsUnableToAccessSiteException ( Exception ex ) : bool
MySiteSearch ( this web ) : List
ProcessQuery ( this web, string keywordQueryValue, List sites, KeywordQuery keywordQuery, int startRow ) : int

Runs a query

RemoveAppInstanceByTitle ( this web, string appTitle ) : bool
RemovePropertyBagValueInternal ( Web web, string key, bool checkIndexed ) : void

Removes a property bag value

SetPropertyBagValueInternal ( Web web, string key, object value ) : void

Sets a key/value pair in the web property bag

SiteSearch ( this web, string keywordQueryValue, bool trimDublicates = true ) : List

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

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

Marks a property bag key for indexing
public static AddIndexedPropertyBagKey ( this web, string key ) : bool
web this The web to process
key string The key to mark for indexing
Результат bool

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

Registers a remote event receiver
public static AddRemoteEventReceiver ( this web, string name, string url, EventReceiverType eventReceiverType, EventReceiverSynchronization synchronization, bool force ) : EventReceiverDefinition
web this The web to process
name string The name of the event receiver (needs to be unique among the event receivers registered on this list)
url string The URL of the remote WCF service that handles the event
eventReceiverType EventReceiverType
synchronization EventReceiverSynchronization
force bool If True any event already registered with the same name will be removed first.
Результат EventReceiverDefinition

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

Registers a remote event receiver
public static AddRemoteEventReceiver ( this web, string name, string url, EventReceiverType eventReceiverType, EventReceiverSynchronization synchronization, int sequenceNumber, bool force ) : EventReceiverDefinition
web this The web to process
name string The name of the event receiver (needs to be unique among the event receivers registered on this list)
url string The URL of the remote WCF service that handles the event
eventReceiverType EventReceiverType
synchronization EventReceiverSynchronization
sequenceNumber int
force bool If True any event already registered with the same name will be removed first.
Результат EventReceiverDefinition

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

Can be used to apply custom remote provisioning template on top of existing site.
public static ApplyProvisioningTemplate ( this web, OfficeDevPnP.Core.Framework.Provisioning.Model.ProvisioningTemplate template, OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ProvisioningTemplateApplyingInformation applyingInformation = null ) : void
web this
template OfficeDevPnP.Core.Framework.Provisioning.Model.ProvisioningTemplate ProvisioningTemplate with the settings to be applied
applyingInformation OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ProvisioningTemplateApplyingInformation Specified additional settings and or properties
Результат void

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

Adds a new child Web (site) to a parent Web.
public static CreateWeb ( this parentWeb, OfficeDevPnP.Core.Entities.SiteEntity subsite, bool inheritPermissions = true, bool inheritNavigation = true ) : Web
parentWeb this The parent Web (site) to create under
subsite OfficeDevPnP.Core.Entities.SiteEntity Details of the Web (site) to add. Only Title, Url (as the leaf URL), Description, Template and Language are used.
inheritPermissions bool Specifies whether the new site will inherit permissions from its parent site.
inheritNavigation bool Specifies whether the site inherits navigation.
Результат Web

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

Adds a new child Web (site) to a parent Web.
public static CreateWeb ( this parentWeb, string title, string leafUrl, string description, string template, int language, bool inheritPermissions = true, bool inheritNavigation = true ) : Web
parentWeb this The parent Web (site) to create under
title string The title of the new site.
leafUrl string A string that represents the URL leaf name.
description string The description of the new site.
template string The name of the site template to be used for creating the new site.
language int The locale ID that specifies the language of the new site.
inheritPermissions bool Specifies whether the new site will inherit permissions from its parent site.
inheritNavigation bool Specifies whether the site inherits navigation.
Результат Web

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

Disables the request access on the web.
public static DisableRequestAccess ( this web ) : void
web this The web to disable request access.
Результат void

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

Enables request access for the specified e-mail addresses.
public static EnableRequestAccess ( this web ) : void
web this The web to enable request access.
Результат void

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

Enables request access for the specified e-mail addresses.
public static EnableRequestAccess ( this web, IEnumerable emails ) : void
web this The web to enable request access.
emails IEnumerable The e-mail addresses to send access requests to.
Результат void

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

Gets the collection of the URLs of all Web sites that are contained within the site collection, including the top-level site and its subsites.

This is analagous to the SPSite.AllWebs property and can be used to get a collection of all web site URLs to loop through, e.g. for branding.

public static GetAllWebUrls ( this site ) : IEnumerable
site this Site collection to retrieve the URLs for.
Результат IEnumerable

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

Returns all app instances
public static GetAppInstances ( this web ) : ClientObjectList
web this The site to process
Результат ClientObjectList

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

Returns the Base Template ID for the current web
public static GetBaseTemplateId ( this parentWeb ) : String
parentWeb this The parent Web (site) to get the base template from
Результат String

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

Returns an event receiver definition
public static GetEventReceiverById ( this web, Guid id ) : EventReceiverDefinition
web this Web to process
id Guid
Результат EventReceiverDefinition

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

Returns an event receiver definition
public static GetEventReceiverByName ( this web, string name ) : EventReceiverDefinition
web this
name string
Результат EventReceiverDefinition

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

Returns all keys in the property bag that have been marked for indexing
public static GetIndexedPropertyBagKeys ( this web ) : IEnumerable
web this The site to process
Результат IEnumerable

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

Get DateTime typed property bag value. If does not contain, returns default value.
public static GetPropertyBagValueDateTime ( this web, string key, DateTime defaultValue ) : DateTime?
web this Web to read the property bag value from
key string Key of the property bag entry to return
defaultValue DateTime
Результат DateTime?

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

Get int typed property bag value. If does not contain, returns default value.
public static GetPropertyBagValueInt ( this web, string key, int defaultValue ) : int?
web this Web to read the property bag value from
key string Key of the property bag entry to return
defaultValue int
Результат int?

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

Get string typed property bag value. If does not contain, returns given default value.
public static GetPropertyBagValueString ( this web, string key, string defaultValue ) : string
web this Web to read the property bag value from
key string Key of the property bag entry to return
defaultValue string
Результат string

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

Can be used to extract custom provisioning template from existing site. The extracted template will be compared with the default base template.
public static GetProvisioningTemplate ( this web ) : ProvisioningTemplate
web this Web to get template from
Результат ProvisioningTemplate

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

Can be used to extract custom provisioning template from existing site. The extracted template will be compared with the default base template.
public static GetProvisioningTemplate ( this web, ProvisioningTemplateCreationInformation creationInfo ) : ProvisioningTemplate
web this Web to get template from
creationInfo ProvisioningTemplateCreationInformation Specifies additional settings and/or properties
Результат ProvisioningTemplate

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

Gets the request access e-mail addresses of the web.
public static GetRequestAccessEmails ( this web ) : IEnumerable
web this The web to get the request access e-mail addresses from.
Результат IEnumerable

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

Returns the child Web site with the specified leaf URL.

The ServerRelativeUrl property of the retrieved Web is instantiated.

public static GetWeb ( this parentWeb, string leafUrl ) : Web
parentWeb this The Web site to check under
leafUrl string A string that represents the URL leaf name.
Результат Web

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

Detects if the site in question has no script enabled or not. Detection is done by verifying if the AddAndCustomizePages permission is missing. See https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f for the effects of NoScript
public static IsNoScriptSite ( this site ) : bool
site this site to verify
Результат bool

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

public static IsPublishingWeb ( this web ) : bool
web this
Результат bool

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

Checks if the current web is a sub site or not
public static IsSubSite ( this web ) : bool
web this Web to check
Результат bool

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

Checks if the given property bag entry exists
public static PropertyBagContainsKey ( this web, string key ) : bool
web this Site to be processed - can be root web or sub site
key string Key of the property bag entry to check
Результат bool

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

Queues a web for a full crawl the next incremental crawl
public static ReIndexWeb ( this web ) : void
web this Site to be processed
Результат void

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

Unmarks a property bag key for indexing
public static RemoveIndexedPropertyBagKey ( this web, string key ) : bool
web this The site to process
key string The key to unmark for indexed. Case-sensitive
Результат bool

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

Removes a property bag value from the property bag
public static RemovePropertyBagValue ( this web, string key ) : void
web this The site to process
key string The key to remove
Результат void

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

Can be used to set translations for different cultures.
public static SetLocalizationLabels ( this web, string cultureName, string titleResource, string descriptionResource ) : void
web this Site to be processed - can be root web or sub site
cultureName string Culture name like en-us or fi-fi
titleResource string Localized Title string
descriptionResource string Localized Description string
Результат void

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

Sets output cache on publishing web. The settings can be maintained from UI by visiting url /_layouts/15/sitecachesettings.aspx
public static SetPageOutputCache ( this web, bool enableOutputCache, int anonymousCacheProfileId, int authenticatedCacheProfileId, bool debugCacheInformation ) : void
web this SharePoint web
enableOutputCache bool Specify true to enable output cache. False otherwise.
anonymousCacheProfileId int Applies for anonymous users access for a site in Site Collection. Id of the profile specified in "Cache Profiles" list.
authenticatedCacheProfileId int Applies for authenticated users access for a site in the Site Collection. Id of the profile specified in "Cache Profiles" list.
debugCacheInformation bool Specify true to enable the display of additional cache information on pages in this site collection. False otherwise.
Результат void

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

Sets a key/value pair in the web property bag
public static SetPropertyBagValue ( this web, string key, DateTime value ) : void
web this Web that will hold the property bag entry
key string Key for the property bag entry
value DateTime Datetime value for the property bag entry
Результат void

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

Sets a key/value pair in the web property bag
public static SetPropertyBagValue ( this web, string key, int value ) : void
web this Web that will hold the property bag entry
key string Key for the property bag entry
value int Integer value for the property bag entry
Результат void

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

Sets a key/value pair in the web property bag
public static SetPropertyBagValue ( this web, string key, string value ) : void
web this Web that will hold the property bag entry
key string Key for the property bag entry
value string String value for the property bag entry
Результат void

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

Returns all site collections that are indexed. In MT the search center, mysite host and contenttype hub are defined as non indexable by default and thus are not returned
public static SiteSearch ( this web ) : List
web this Site to be processed - can be root web or sub site
Результат List

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

Returns all site collection that match with the provided title
public static SiteSearchScopedByTitle ( this web, string siteTitle ) : List
web this Site to be processed - can be root web or sub site
siteTitle string Title of the site to search for
Результат List

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

Returns all site collection that start with the provided URL
public static SiteSearchScopedByUrl ( this web, string siteUrl ) : List
web this Site to be processed - can be root web or sub site
siteUrl string Base URL for which sites can be returned
Результат List

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

Uninstalls a sandbox solution package (.WSP) file
public static UninstallSolution ( this site, Guid packageGuid, string fileName, int majorVersion = 1, int minorVersion ) : void
site this Site collection to install to
packageGuid Guid ID of the solution, from the solution manifest
fileName string filename of the WSP file to uninstall
majorVersion int Optional major version of the solution, defaults to 1
minorVersion int Optional minor version of the solution, defaults to 0
Результат void

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

Determines if a child Web site with the specified leaf URL exists.
public static WebExists ( this parentWeb, string leafUrl ) : bool
parentWeb this The Web site to check under
leafUrl string A string that represents the URL leaf name.
Результат bool

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

Determines if a web exists by title.
public static WebExistsByTitle ( this parentWeb, string title ) : bool
parentWeb this Parent web to check under.
title string Title of the web to check.
Результат bool

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

Determines if a Web (site) exists at the specified full URL, either accessible or that returns an access error.
public static WebExistsFullUrl ( this context, string webFullUrl ) : bool
context this Existing context, used to provide credentials.
webFullUrl string Full URL of the site to check.
Результат bool