class UserExperienceState
UserExperienceState is a SharePoint entity class that represents the user experience state within a SharePoint environment, inheriting from the Entity base class.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/tenant/apps/user_experience_state.py
4 - 5
simple
Purpose
This class serves as a data model for managing and representing user experience state information in SharePoint Online. It inherits from the Entity base class, which provides common functionality for SharePoint entities such as property management, serialization, and API interaction capabilities. The class is designed to be used within the office365-rest-python-client library for interacting with SharePoint's REST API endpoints related to user experience settings and state.
Source Code
class UserExperienceState(Entity):
""""""
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
Entity | - |
Parameter Details
bases: Inherits from Entity class which provides the foundational SharePoint entity functionality including property bags, context management, and REST API communication capabilities
Return Value
Instantiation returns a UserExperienceState object that represents a SharePoint user experience state entity. The object inherits all methods and properties from the Entity base class, allowing interaction with SharePoint's REST API for user experience state operations.
Class Interface
Methods
__init__(context, resource_path=None)
Purpose: Initializes a new UserExperienceState entity instance (inherited from Entity)
Parameters:
context: ClientContext object for SharePoint API communicationresource_path: Optional ResourcePath object specifying the entity's location in SharePoint
Returns: UserExperienceState instance
load(properties=None)
Purpose: Prepares the entity to load its properties from SharePoint (inherited from Entity)
Parameters:
properties: Optional list of property names to load; if None, loads all properties
Returns: Self for method chaining
get_property(name, default_value=None)
Purpose: Retrieves a property value from the entity (inherited from Entity)
Parameters:
name: Name of the property to retrievedefault_value: Default value to return if property doesn't exist
Returns: Property value or default_value if not found
set_property(name, value, persist_changes=True)
Purpose: Sets a property value on the entity (inherited from Entity)
Parameters:
name: Name of the property to setvalue: Value to assign to the propertypersist_changes: Whether to track this change for persistence
Returns: Self for method chaining
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
context |
ClientContext | The SharePoint client context used for API communication (inherited from Entity) | instance |
properties |
dict | Dictionary containing the entity's properties loaded from SharePoint (inherited from Entity) | instance |
resource_path |
ResourcePath | The resource path identifying this entity's location in SharePoint (inherited from Entity) | instance |
Dependencies
office365-rest-python-client
Required Imports
from office365.sharepoint.userexperience.user_experience_state import UserExperienceState
Usage Example
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.userexperience.user_experience_state import UserExperienceState
from office365.runtime.auth.user_credential import UserCredential
# Setup authentication
site_url = 'https://yourtenant.sharepoint.com/sites/yoursite'
credentials = UserCredential('username@tenant.onmicrosoft.com', 'password')
ctx = ClientContext(site_url).with_credentials(credentials)
# Instantiate UserExperienceState
ux_state = UserExperienceState(ctx)
# Load and access properties (inherited from Entity)
ux_state.load()
ctx.execute_query()
# Access properties as needed
properties = ux_state.properties
Best Practices
- Always initialize with a valid ClientContext object that has proper authentication configured
- Use the load() method before accessing properties to ensure data is fetched from SharePoint
- Call ctx.execute_query() after load() to actually execute the REST API request
- Handle exceptions that may occur during API communication
- The class currently has no custom implementation beyond Entity inheritance, so all functionality comes from the base Entity class
- Check the Entity base class documentation for available methods like get_property(), set_property(), and ensure_property()
- This class may be extended in future versions with specific user experience state methods and properties
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class EmployeeExperienceUser 74.1% similar
-
class EmployeeExperienceController 71.2% similar
-
class UserSolution 68.5% similar
-
class ExternalUser 67.2% similar
-
class User_v1 62.7% similar