🔍 Code Extractor

class SharingAbilities

Maturity: 49

Represents the matrix of possible sharing abilities for direct sharing and tokenized sharing links along with the state of each capability for the current user in SharePoint.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/abilities.py
Lines:
6 - 37
Complexity:
simple

Purpose

This class encapsulates all sharing capability configurations for a SharePoint resource, including anonymous links, organization links, people-specific links, and direct sharing. It serves as a comprehensive container for determining what sharing options are available to the current user for a given document or resource. The class inherits from ClientValue, indicating it's part of the Office365 SharePoint API client library and represents a value object that can be serialized/deserialized for API communication.

Source Code

class SharingAbilities(ClientValue):
    """
    Represents the matrix of possible sharing abilities for direct sharing and tokenized sharing links along
    with the state of each capability for the current user.
    """

    def __init__(
        self,
        anonymous_link_abilities=SharingLinkAbilities(),
        anyone_link_abilities=SharingLinkAbilities(),
        direct_sharing_abilities=DirectSharingAbilities(),
        organization_link_abilities=SharingLinkAbilities(),
        people_sharing_link_abilities=SharingLinkAbilities(),
    ):
        """
        :param SharingLinkAbilities anonymous_link_abilities: Indicates abilities for anonymous access links.
        :param SharingLinkAbilities anonymous_link_abilities:
        :param DirectSharingAbilities direct_sharing_abilities: Indicates abilities for direct sharing of a document
            using the canonical URL.
        :param SharingLinkAbilities organization_link_abilities: Indicates abilities for organization access links.
        :param SharingLinkAbilities people_sharing_link_abilities: Indicates abilities for tokenized sharing links that
            are configured to support only a predefined restricted membership set.
        """
        self.anonymousLinkAbilities = anonymous_link_abilities
        self.anyoneLinkAbilities = anyone_link_abilities
        self.directSharingAbilities = direct_sharing_abilities
        self.organizationLinkAbilities = organization_link_abilities
        self.peopleSharingLinkAbilities = people_sharing_link_abilities

    @property
    def entity_type_name(self):
        return "SP.Sharing.SharingAbilities"

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

anonymous_link_abilities: A SharingLinkAbilities instance that defines the capabilities and permissions for anonymous access links (links that can be accessed by anyone without authentication). Defaults to an empty SharingLinkAbilities() instance.

anyone_link_abilities: A SharingLinkAbilities instance that defines the capabilities for 'anyone' links (similar to anonymous but may have different permission scopes). Defaults to an empty SharingLinkAbilities() instance.

direct_sharing_abilities: A DirectSharingAbilities instance that defines the capabilities for direct sharing of a document using its canonical URL (sharing directly with specific users or groups). Defaults to an empty DirectSharingAbilities() instance.

organization_link_abilities: A SharingLinkAbilities instance that defines the capabilities for organization-wide access links (links accessible only to users within the same organization). Defaults to an empty SharingLinkAbilities() instance.

people_sharing_link_abilities: A SharingLinkAbilities instance that defines the capabilities for tokenized sharing links configured to support only a predefined restricted membership set (specific people links). Defaults to an empty SharingLinkAbilities() instance.

Return Value

Instantiation returns a SharingAbilities object that contains five attributes representing different sharing capability configurations. The entity_type_name property returns the string 'SP.Sharing.SharingAbilities', which is used for SharePoint API serialization and type identification.

Class Interface

Methods

__init__(self, anonymous_link_abilities=SharingLinkAbilities(), anyone_link_abilities=SharingLinkAbilities(), direct_sharing_abilities=DirectSharingAbilities(), organization_link_abilities=SharingLinkAbilities(), people_sharing_link_abilities=SharingLinkAbilities())

Purpose: Initializes a new SharingAbilities instance with configurations for all types of sharing capabilities

Parameters:

  • anonymous_link_abilities: SharingLinkAbilities instance for anonymous access links
  • anyone_link_abilities: SharingLinkAbilities instance for anyone links
  • direct_sharing_abilities: DirectSharingAbilities instance for direct sharing via canonical URL
  • organization_link_abilities: SharingLinkAbilities instance for organization-wide links
  • people_sharing_link_abilities: SharingLinkAbilities instance for restricted membership links

Returns: None (constructor)

@property entity_type_name(self) -> str property

Purpose: Returns the SharePoint entity type name used for API serialization and type identification

Returns: String 'SP.Sharing.SharingAbilities' representing the SharePoint entity type

Attributes

Name Type Description Scope
anonymousLinkAbilities SharingLinkAbilities Stores the abilities configuration for anonymous access links (links accessible without authentication) instance
anyoneLinkAbilities SharingLinkAbilities Stores the abilities configuration for 'anyone' links with potentially different permission scopes than anonymous instance
directSharingAbilities DirectSharingAbilities Stores the abilities configuration for direct sharing using canonical URLs with specific users or groups instance
organizationLinkAbilities SharingLinkAbilities Stores the abilities configuration for organization-wide access links (restricted to organization members) instance
peopleSharingLinkAbilities SharingLinkAbilities Stores the abilities configuration for tokenized sharing links with predefined restricted membership instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue
from office365.sharepoint.sharing.direct_abilities import DirectSharingAbilities
from office365.sharepoint.sharing.link_abilities import SharingLinkAbilities

Usage Example

from office365.sharepoint.sharing.abilities import SharingAbilities
from office365.sharepoint.sharing.link_abilities import SharingLinkAbilities
from office365.sharepoint.sharing.direct_abilities import DirectSharingAbilities

# Create individual ability objects with specific configurations
anon_abilities = SharingLinkAbilities()
org_abilities = SharingLinkAbilities()
direct_abilities = DirectSharingAbilities()

# Instantiate SharingAbilities with custom configurations
sharing_abilities = SharingAbilities(
    anonymous_link_abilities=anon_abilities,
    organization_link_abilities=org_abilities,
    direct_sharing_abilities=direct_abilities
)

# Access specific ability configurations
print(sharing_abilities.anonymousLinkAbilities)
print(sharing_abilities.directSharingAbilities)

# Get the entity type name for API serialization
entity_type = sharing_abilities.entity_type_name
print(entity_type)  # Output: 'SP.Sharing.SharingAbilities'

Best Practices

  • This class is typically instantiated by the Office365 SharePoint client library when querying sharing settings, rather than being manually constructed by end users.
  • All constructor parameters have default values, so the class can be instantiated without arguments for default configurations.
  • The class is immutable after construction - attributes are set in __init__ and not modified thereafter, following value object patterns.
  • Use the entity_type_name property when serializing this object for SharePoint API requests to ensure proper type identification.
  • This class represents a snapshot of sharing abilities at a point in time; it does not automatically update if permissions change.
  • Each ability attribute (anonymousLinkAbilities, directSharingAbilities, etc.) should be accessed to determine specific sharing capabilities for different sharing methods.
  • The class inherits from ClientValue, which means it's designed to be part of request/response payloads in the Office365 API client library.

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class SharingLinkAbilities 89.1% similar

    A data class representing the set of capabilities for tokenized sharing links in SharePoint, indicating which sharing operations are enabled or disabled for the current user.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/link_abilities.py
  • class DirectSharingAbilities 85.1% similar

    A data class representing the set of direct sharing capabilities available to the current user in SharePoint, including permissions to add external/internal principals and request access grants.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/direct_abilities.py
  • class SharingAbilityStatus 79.0% similar

    A data class representing the status of a specific sharing capability for the current user in SharePoint, including whether it's enabled and the reason if disabled.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/ability_status.py
  • class SharingLinkAccessRequest 78.6% similar

    A data class representing extended values required for requesting access to SharePoint objects exposed through tokenized sharing links, including password and access persistence options.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/links/access_request.py
  • class ShareLinkRequest 75.9% similar

    A data class representing a request for retrieving or creating a tokenized sharing link in SharePoint, encapsulating all necessary parameters for link configuration.

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