class SharePointOneDriveOptions
A data class that encapsulates search content options for SharePoint and OneDrive searches performed using application permissions.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/search/sharepoint_onedrive_options.py
4 - 8
simple
Purpose
This class serves as a configuration container for specifying search content options when performing searches in SharePoint or OneDrive with application-level permissions. It inherits from ClientValue, which is part of the Office365 REST API client framework, allowing it to be serialized and transmitted as part of API requests. The class is designed to hold search-related parameters that control how content is searched and retrieved.
Source Code
class SharePointOneDriveOptions(ClientValue):
"""Provides the search content options when a search is performed using application permissions"""
def __init__(self, search_content=None):
self.searchContent = search_content
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
search_content: Optional parameter that specifies the search content configuration. This can be None (default) or a value that defines what content should be searched. The exact type and structure depend on the SharePoint/OneDrive API requirements for search operations with application permissions.
Return Value
Instantiation returns a SharePointOneDriveOptions object with the searchContent attribute set to the provided value or None. This object can be used as a parameter in SharePoint/OneDrive search API calls.
Class Interface
Methods
__init__(self, search_content=None)
Purpose: Initializes a new instance of SharePointOneDriveOptions with optional search content configuration
Parameters:
search_content: Optional parameter specifying the search content options. Defaults to None if not provided.
Returns: None (constructor)
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
searchContent |
Any (typically string or dict, depends on API requirements) | Stores the search content configuration that will be used when performing SharePoint/OneDrive searches with application permissions. The value is set during initialization and can be accessed or modified directly. | instance |
Dependencies
office365
Required Imports
from office365.runtime.client_value import ClientValue
Usage Example
from office365.runtime.client_value import ClientValue
from office365.sharepoint.search.options import SharePointOneDriveOptions
# Create options with no search content specified
options = SharePointOneDriveOptions()
# Create options with specific search content
search_config = "documents" # Example value
options_with_content = SharePointOneDriveOptions(search_content=search_config)
# Access the search content
print(options_with_content.searchContent) # Output: documents
# Typically used in conjunction with SharePoint search API calls
# from office365.sharepoint.client_context import ClientContext
# ctx = ClientContext(site_url).with_credentials(credentials)
# results = ctx.search.query(query_text, options=options_with_content)
Best Practices
- This class is a simple data container and should be instantiated with appropriate search content values based on SharePoint/OneDrive API documentation
- The class inherits from ClientValue, which means it's designed to be serialized for API requests - do not add complex objects that cannot be serialized
- Keep the searchContent parameter aligned with the expected format of the SharePoint/OneDrive search API
- This class is typically used as a parameter to search methods rather than being used standalone
- Since it's a configuration object, it's generally safe to create multiple instances with different configurations for different search operations
- The class has no side effects and maintains no internal state beyond the searchContent attribute
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class FilePickerOptions 67.8% similar
-
class AlterationOptions 67.3% similar
-
class SearchEndpoints 65.6% similar
-
class ExpandedQueryParameters 63.9% similar
-
class CallOptions 63.8% similar