🔍 Code Extractor

class SharePointSharingSettings

Maturity: 45

A class representing SharePoint UI-specific sharing settings, providing access to people picker properties and other sharing-related configurations.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/sharepoint_sharing_settings.py
Lines:
6 - 26
Complexity:
moderate

Purpose

This class serves as a data model for SharePoint sharing settings, specifically handling UI-related sharing configurations. It extends the Entity base class and provides access to picker properties used for initializing client-side people picker controls that allow users to search for and resolve users and groups in SharePoint. The class manages lazy loading of picker properties and provides a custom property resolution mechanism.

Source Code

class SharePointSharingSettings(Entity):
    """This class contains the SharePoint UI-specific sharing settings."""

    @property
    def picker_properties(self):
        """An object containing the necessary information to initialize a client people picker control used
        to search for and resolve desired users and groups."""
        return self.properties.get(
            "PickerProperties",
            PickerSettings(
                self.context, ResourcePath("PickerProperties", self.resource_path)
            ),
        )

    def get_property(self, name, default_value=None):
        if default_value is None:
            property_mapping = {
                "PickerProperties": self.picker_properties,
            }
            default_value = property_mapping.get(name, None)
        return super(SharePointSharingSettings, self).get_property(name, default_value)

Parameters

Name Type Default Kind
bases Entity -

Parameter Details

context: The client context object that provides the connection and authentication information for SharePoint operations. Inherited from Entity base class.

resource_path: The ResourcePath object that identifies the location of this entity in the SharePoint resource hierarchy. Inherited from Entity base class.

Return Value

Instantiation returns a SharePointSharingSettings object that provides access to sharing configuration properties. The picker_properties property returns a PickerSettings object containing information for initializing people picker controls. The get_property method returns the requested property value or a default value if not found.

Class Interface

Methods

@property picker_properties(self) -> PickerSettings property

Purpose: Provides access to the people picker properties used for initializing client-side people picker controls

Returns: A PickerSettings object containing configuration for searching and resolving users and groups in SharePoint

get_property(self, name: str, default_value=None) -> Any

Purpose: Retrieves a property value by name with custom mapping for SharePoint-specific properties

Parameters:

  • name: The name of the property to retrieve (e.g., 'PickerProperties')
  • default_value: Optional default value to return if the property is not found. If None, uses internal property mapping

Returns: The value of the requested property, or the default_value if not found. For 'PickerProperties', returns a PickerSettings object

Attributes

Name Type Description Scope
context ClientContext The SharePoint client context providing connection and authentication (inherited from Entity) instance
resource_path ResourcePath The resource path identifying this entity's location in SharePoint (inherited from Entity) instance
properties dict Dictionary storing the entity's properties loaded from SharePoint (inherited from Entity) instance

Dependencies

  • office365.runtime.paths.resource_path
  • office365.sharepoint.entity
  • office365.sharepoint.sharing.picker_settings

Required Imports

from office365.runtime.paths.resource_path import ResourcePath
from office365.sharepoint.entity import Entity
from office365.sharepoint.sharing.picker_settings import PickerSettings

Usage Example

from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.sharing.sharepoint_sharing_settings import SharePointSharingSettings

# Assuming you have a configured ClientContext
ctx = ClientContext(site_url).with_credentials(credentials)

# Load sharing settings from SharePoint
sharing_settings = ctx.web.get_sharing_settings()
ctx.load(sharing_settings)
ctx.execute_query()

# Access picker properties
picker_props = sharing_settings.picker_properties
ctx.load(picker_props)
ctx.execute_query()

# Get specific property
property_value = sharing_settings.get_property('PickerProperties')

Best Practices

  • Always ensure the context object is properly authenticated before accessing sharing settings
  • Use the picker_properties property to access people picker configuration rather than directly accessing the properties dictionary
  • Call ctx.load() and ctx.execute_query() to ensure properties are loaded from SharePoint before accessing them
  • The class uses lazy loading for picker_properties, so the PickerSettings object is only created when first accessed
  • When extending this class, follow the pattern of using get_property with property_mapping for custom property resolution
  • The get_property method provides a fallback mechanism for property resolution, ensuring consistent behavior with the parent Entity class

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class PickerSettings 83.7% similar

    Configuration settings class for the SharePoint client people picker control, providing access to picker behavior settings and query configurations.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/picker_settings.py
  • class ObjectSharingSettings 75.4% similar

    This class contains the information necessary to read and change the sharing status of a SharePoint object. It also contains a reference to SharePoint specific settings denoted by "SharePointSettings".

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/object_sharing_settings.py
  • class PeoplePickerQuerySettings 75.2% similar

    A data class representing additional settings for SharePoint principal queries, specifically for people picker operations.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/ui/applicationpages/peoplepicker/query_settings.py
  • class SharingInformation 73.2% similar

    Represents sharing information for a SharePoint securable object, providing access to sharing settings, picker configurations, sharing abilities, and link templates.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/information.py
  • class ObjectSharingInformation 68.3% similar

    A class that provides comprehensive information about the sharing state of SharePoint securable objects (documents, list items, sites), including permissions, sharing links, and user access details.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/object_sharing_information.py
← Back to Browse