class SharingInformation
Represents sharing information for a SharePoint securable object, providing access to sharing settings, picker configurations, sharing abilities, and link templates.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/information.py
11 - 61
moderate
Purpose
This class encapsulates the response from Microsoft.SharePoint.Client.Sharing.SecurableObjectExtensions.GetSharingInformation API call. It provides structured access to various sharing-related settings including access request settings, people picker settings, sharing capabilities matrix, and sharing link templates. The class inherits from Entity and follows the SharePoint client object model pattern for lazy-loading properties.
Source Code
class SharingInformation(Entity):
"""Represents a response for Microsoft.SharePoint.Client.Sharing.SecurableObjectExtensions.GetSharingInformation.
The accessRequestSettings, domainRestrictionSettings and permissionsInformation properties are not included in
the default scalar property set for this type.
"""
@property
def access_request_settings(self):
"""
AccessRequestSettings is an optional property set to retrieve details for pending access requests if present.
"""
return self.properties.get("accessRequestSettings", AccessRequestSettings())
@property
def picker_settings(self):
"""PickerSettings used by the PeoplePicker Control."""
return self.properties.get(
"pickerSettings",
PickerSettings(
self.context, ResourcePath("pickerSettings", self.resource_path)
),
)
@property
def sharing_abilities(self):
"""
Matrix of possible sharing abilities per sharing type and the state of each capability for the current user
on the list item."""
return self.properties.get("sharingAbilities", SharingAbilities())
@property
def sharing_link_templates(self):
""""""
return self.properties.get(
"sharingLinkTemplates", SharingLinkDefaultTemplatesCollection()
)
def get_property(self, name, default_value=None):
if default_value is None:
property_mapping = {
"accessRequestSettings": self.access_request_settings,
"pickerSettings": self.picker_settings,
"sharingAbilities": self.sharing_abilities,
"sharingLinkTemplates": self.sharing_link_templates,
}
default_value = property_mapping.get(name, None)
return super(SharingInformation, self).get_property(name, default_value)
@property
def entity_type_name(self):
return "SP.Sharing.SharingInformation"
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
Entity | - |
Parameter Details
context: The client context object used for SharePoint API communication, inherited from Entity base class
resource_path: The resource path identifying the SharePoint object, inherited from Entity base class
Return Value
Instantiation returns a SharingInformation object that provides property-based access to sharing configuration data. Properties return typed objects (AccessRequestSettings, PickerSettings, SharingAbilities, SharingLinkDefaultTemplatesCollection) that may be lazily loaded from the SharePoint server.
Class Interface
Methods
@property access_request_settings(self) -> AccessRequestSettings
property
Purpose: Retrieves details for pending access requests if present
Returns: AccessRequestSettings object containing access request configuration and pending requests
@property picker_settings(self) -> PickerSettings
property
Purpose: Gets the settings used by the PeoplePicker control for user/group selection
Returns: PickerSettings object with context and resource path configured for the people picker
@property sharing_abilities(self) -> SharingAbilities
property
Purpose: Retrieves the matrix of possible sharing abilities per sharing type and their state for the current user
Returns: SharingAbilities object containing capability flags for different sharing scenarios
@property sharing_link_templates(self) -> SharingLinkDefaultTemplatesCollection
property
Purpose: Gets the collection of default sharing link templates available for the object
Returns: SharingLinkDefaultTemplatesCollection containing available link template configurations
get_property(self, name: str, default_value=None) -> Any
Purpose: Retrieves a property value by name with optional default value, providing mapped access to sharing-related properties
Parameters:
name: The property name to retrieve (e.g., 'accessRequestSettings', 'pickerSettings', 'sharingAbilities', 'sharingLinkTemplates')default_value: Optional default value to return if property is not found; if None, uses internal property mapping
Returns: The property value if found, otherwise the default value or mapped property object
@property entity_type_name(self) -> str
property
Purpose: Returns the SharePoint entity type name for this object
Returns: String 'SP.Sharing.SharingInformation' identifying the SharePoint entity type
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
properties |
dict | Dictionary storing the loaded property values from SharePoint, inherited from Entity base class | instance |
context |
ClientContext | The client context object used for SharePoint API communication, inherited from Entity base class | instance |
resource_path |
ResourcePath | The resource path identifying this SharePoint object in the API, inherited from Entity base class | instance |
Dependencies
office365
Required Imports
from office365.sharepoint.sharing.information import SharingInformation
from office365.runtime.paths.resource_path import ResourcePath
from office365.sharepoint.entity import Entity
from office365.sharepoint.sharing.abilities import SharingAbilities
from office365.sharepoint.sharing.access_request_settings import AccessRequestSettings
from office365.sharepoint.sharing.links.default_templates_collection import SharingLinkDefaultTemplatesCollection
from office365.sharepoint.sharing.picker_settings import PickerSettings
Usage Example
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.sharing.information import SharingInformation
# Authenticate and get context
ctx = ClientContext(site_url).with_credentials(credentials)
# Get sharing information for a list item or document
list_item = ctx.web.lists.get_by_title('Documents').items.get_by_id(1)
sharing_info = list_item.get_sharing_information().execute_query()
# Access sharing properties
access_settings = sharing_info.access_request_settings
picker_config = sharing_info.picker_settings
sharing_abilities = sharing_info.sharing_abilities
link_templates = sharing_info.sharing_link_templates
# Check specific sharing capabilities
can_share_externally = sharing_abilities.can_share_externally
can_request_access = access_settings.is_enabled
Best Practices
- Always call execute_query() on the parent context after retrieving sharing information to ensure properties are loaded from the server
- Properties are lazily loaded - access them only after the query has been executed to avoid empty/default values
- The class follows the SharePoint client object model pattern where properties return default empty objects if not yet loaded
- Use get_property() method for dynamic property access with custom default values
- Note that accessRequestSettings, domainRestrictionSettings, and permissionsInformation are not included in the default scalar property set and may require explicit loading
- The picker_settings property creates a new PickerSettings object with proper context and resource path for nested property access
- Check entity_type_name property to verify the correct SharePoint entity type (SP.Sharing.SharingInformation)
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class ObjectSharingInformation 82.0% similar
-
class SharingPermissionInformation 75.8% similar
-
class ObjectSharingSettings 73.4% similar
-
class SharePointSharingSettings 73.2% similar
-
class SharingInformationRequest 72.2% similar