class TenantCrawlVersionsInfoProvider
A SharePoint client class that manages crawl versions settings at the tenant and site level, providing methods to check and disable version crawling functionality.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/search/administration/tenant_crawl_versions_info_provider.py
6 - 44
moderate
Purpose
This class serves as a provider for managing SharePoint search crawl versions information at the tenant level. It allows administrators to query whether crawl versions are enabled for the entire tenant or specific sites, and provides functionality to disable crawl versions for individual sites. This is typically used in SharePoint Online search administration scenarios where version history crawling needs to be controlled for performance or storage optimization.
Source Code
class TenantCrawlVersionsInfoProvider(Entity):
""" """
def disable_crawl_versions(self, site_id):
"""
:param str site_id:
"""
return_type = ClientResult(self.context, bool())
payload = {"siteId": site_id}
qry = ServiceOperationQuery(
self, "DisableCrawlVersions", None, payload, None, return_type
)
self.context.add_query(qry)
return return_type
def is_crawl_versions_enabled(self, site_id):
"""
:param str site_id:
"""
return_type = ClientResult(self.context, bool())
payload = {"siteId": site_id}
qry = ServiceOperationQuery(
self, "IsCrawlVersionsEnabled", None, payload, None, return_type
)
self.context.add_query(qry)
return return_type
def is_crawl_versions_enabled_for_tenant(self):
""" """
return_type = ClientResult(self.context, bool())
qry = ServiceOperationQuery(
self, "IsCrawlVersionsEnabledForTenant", None, None, None, return_type
)
self.context.add_query(qry)
return return_type
@property
def entity_type_name(self):
return "Microsoft.SharePoint.Client.Search.Administration.TenantCrawlVersionsInfoProvider"
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
Entity | - |
Parameter Details
context: Inherited from Entity base class. The client context object that manages the connection to SharePoint and handles query execution. This is automatically set when the object is instantiated through the SharePoint client object model.
Return Value
The class instantiation returns a TenantCrawlVersionsInfoProvider object. All public methods return ClientResult objects wrapping boolean values: disable_crawl_versions returns a ClientResult[bool] indicating success/failure of the disable operation; is_crawl_versions_enabled returns a ClientResult[bool] indicating if crawl versions are enabled for the specified site; is_crawl_versions_enabled_for_tenant returns a ClientResult[bool] indicating if crawl versions are enabled at the tenant level.
Class Interface
Methods
disable_crawl_versions(site_id: str) -> ClientResult
Purpose: Disables crawl versions functionality for a specific SharePoint site
Parameters:
site_id: The GUID identifier of the SharePoint site for which to disable crawl versions
Returns: ClientResult object wrapping a boolean value indicating whether the disable operation was successful. The actual value is available after calling context.execute_query()
is_crawl_versions_enabled(site_id: str) -> ClientResult
Purpose: Checks whether crawl versions are enabled for a specific SharePoint site
Parameters:
site_id: The GUID identifier of the SharePoint site to check
Returns: ClientResult object wrapping a boolean value indicating whether crawl versions are enabled for the specified site. The actual value is available after calling context.execute_query()
is_crawl_versions_enabled_for_tenant() -> ClientResult
Purpose: Checks whether crawl versions are enabled at the tenant level across all sites
Returns: ClientResult object wrapping a boolean value indicating whether crawl versions are enabled for the entire tenant. The actual value is available after calling context.execute_query()
entity_type_name() -> str
property
Purpose: Returns the fully qualified entity type name used by SharePoint's client object model
Returns: String value 'Microsoft.SharePoint.Client.Search.Administration.TenantCrawlVersionsInfoProvider' representing the SharePoint entity type
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
context |
ClientContext | Inherited from Entity base class. The SharePoint client context that manages the connection and executes queries against SharePoint services | instance |
Dependencies
office365
Required Imports
from office365.runtime.client_result import ClientResult
from office365.runtime.queries.service_operation import ServiceOperationQuery
from office365.sharepoint.entity import Entity
Usage Example
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.search.administration.tenant_crawl_versions_info_provider import TenantCrawlVersionsInfoProvider
# Authenticate and get context
ctx = ClientContext('https://tenant.sharepoint.com').with_credentials(user_credentials)
# Get the provider instance
provider = TenantCrawlVersionsInfoProvider(ctx)
# Check if crawl versions enabled for tenant
result = provider.is_crawl_versions_enabled_for_tenant()
ctx.execute_query()
print(f'Tenant crawl versions enabled: {result.value}')
# Check if crawl versions enabled for specific site
site_id = 'your-site-guid'
site_result = provider.is_crawl_versions_enabled(site_id)
ctx.execute_query()
print(f'Site crawl versions enabled: {site_result.value}')
# Disable crawl versions for a site
disable_result = provider.disable_crawl_versions(site_id)
ctx.execute_query()
print(f'Disable operation success: {disable_result.value}')
Best Practices
- Always call ctx.execute_query() after invoking any method to actually execute the operation against SharePoint
- The ClientResult objects returned by methods only contain values after execute_query() is called
- Ensure the authenticated user has tenant administrator or search administrator permissions
- Use site_id parameter as a GUID string, not a URL
- Methods are designed for deferred execution - multiple operations can be queued before calling execute_query()
- Check the value property of ClientResult objects only after execute_query() completes
- Handle exceptions that may occur during execute_query() for network or permission issues
- Disabling crawl versions affects search indexing behavior and should be done with caution
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class SiteContentProcessingInfoProvider 60.8% similar
-
class DocumentCrawlLog 60.5% similar
-
class TenantAdminSettingsService 60.0% similar
-
class TenantSettings 58.6% similar
-
class SitePageVersionInfo 57.9% similar