Class SearchExtensions
Class for Search extension methods
Inheritance
System.Object
SearchExtensions
Namespace: Microsoft.SharePoint.Client
Assembly: PnP.Framework.dll
Syntax
public static class SearchExtensions : object
Class for Search extension methods
public static class SearchExtensions : object
Delete the search configuration - does not apply to managed properties.
public static void DeleteSearchConfiguration(this Site site, string searchConfiguration)
Site
site
A SharePoint site |
System.String
searchConfiguration
search configuration |
Delete the search configuration - does not apply to managed properties.
public static void DeleteSearchConfiguration(this Web web, string searchConfiguration)
Web
web
A SharePoint site/subsite |
System.String
searchConfiguration
search configuration |
Delete search settings from configuration xml.
public static void DeleteSearchSettings(this ClientContext context, string searchConfiguration, SearchObjectLevel searchSettingsImportLevel)
ClientContext
context
Context for SharePoint objects and operations |
System.String
searchConfiguration
Search schema xml file path |
SearchObjectLevel
searchSettingsImportLevel
Search settings import level Reference: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.search.administration.searchobjectlevel(v=office.15).aspx |
Exports the search settings to file.
public static void ExportSearchSettings(this ClientContext context, string exportFilePath, SearchObjectLevel searchSettingsExportLevel)
ClientContext
context
Context for SharePoint objects and operations |
System.String
exportFilePath
Path where to export the search settings |
SearchObjectLevel
searchSettingsExportLevel
Search settings export level Reference: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.search.administration.searchobjectlevel(v=office.15).aspx |
Returns the current search configuration as as string
public static string GetSearchConfiguration(this Site site)
Site
site
A SharePoint site |
System.String
Returns search configuration |
Returns the current search configuration as as string
public static string GetSearchConfiguration(this Web web)
Web
web
A SharePoint site/subsiste |
System.String
Returns search configuration |
Get the search center URL for the site collection (Site Settings -> Site collection administration --> Search Settings)
public static string GetSiteCollectionSearchCenterUrl(this Web web)
Web
web
SharePoint site - root web |
System.String
Search center URL for web |
Get the search results page URL for the web (Site Settings -> Search --> Search Settings)
public static string GetWebSearchCenterUrl(this Web web, bool urlOnly = false)
Web
web
SharePoint site - current web |
System.Boolean
urlOnly
Allows to declare to return the URL only and not the full JSON settings |
System.String
Search results page URL for web |
Imports search settings from file.
public static void ImportSearchSettings(this ClientContext context, string searchSchemaImportFilePath, SearchObjectLevel searchSettingsImportLevel)
ClientContext
context
Context for SharePoint objects and operations |
System.String
searchSchemaImportFilePath
Search schema xml file path |
SearchObjectLevel
searchSettingsImportLevel
Search settings import level Reference: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.search.administration.searchobjectlevel(v=office.15).aspx |
Imports search settings from configuration xml.
public static void ImportSearchSettingsConfiguration(this ClientContext context, string searchConfiguration, SearchObjectLevel searchSettingsImportLevel)
ClientContext
context
Context for SharePoint objects and operations |
System.String
searchConfiguration
Search schema xml file path |
SearchObjectLevel
searchSettingsImportLevel
Search settings import level Reference: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.search.administration.searchobjectlevel(v=office.15).aspx |
public static void SetSearchBoxPlaceholderText(this Site site, string placeholderText, string tenantAdminUrl = null)
Site
site
|
System.String
placeholderText
|
System.String
tenantAdminUrl
|
public static void SetSearchBoxPlaceholderText(this Web web, string placeholderText, string tenantAdminUrl = null)
Web
web
|
System.String
placeholderText
|
System.String
tenantAdminUrl
|
Sets the search configuration
public static void SetSearchConfiguration(this Site site, string searchConfiguration)
Site
site
A SharePoint site |
System.String
searchConfiguration
search configuration |
Sets the search configuration
public static void SetSearchConfiguration(this Web web, string searchConfiguration)
Web
web
A SharePoint site/subsite |
System.String
searchConfiguration
search configuration |
Sets the search center URL on site collection (Site Settings -> Site collection administration --> Search Settings)
public static void SetSiteCollectionSearchCenterUrl(this Web web, string searchCenterUrl, string tenantAdminUrl = null)
Web
web
SharePoint site - root web |
System.String
searchCenterUrl
Search center URL |
System.String
tenantAdminUrl
Url to the tenant admin site. Optional. Will try to determine automatically if omitted. |
Sets the search results page URL on current web (Site Settings -> Search --> Search Settings)
public static void SetWebSearchCenterUrl(this Web web, string searchCenterUrl, string tenantAdminUrl = null)
Web
web
SharePoint current web |
System.String
searchCenterUrl
Search results page URL |
System.String
tenantAdminUrl
Url to the tenant admin site. Optional. Will try to determine automatically if omitted. |