🔍 Code Extractor

class SharingLinkAbilities

Maturity: 48

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.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/link_abilities.py
Lines:
5 - 35
Complexity:
simple

Purpose

This class encapsulates the permissions and abilities a user has regarding SharePoint sharing links. It tracks whether the user can perform various sharing operations such as adding external principals, deleting edit/manage links, and getting read/edit links. It inherits from ClientValue, making it suitable for serialization and communication with SharePoint services.

Source Code

class SharingLinkAbilities(ClientValue):
    """
    Represents the set of capabilities for specific configurations of tokenized sharing link for the current user
    and whether they are enabled or not.
    """

    def __init__(
        self,
        can_add_new_external_principals=SharingAbilityStatus(),
        can_delete_edit_link=SharingAbilityStatus(),
        can_delete_manage_list_link=SharingAbilityStatus(),
        can_get_edit_link=SharingAbilityStatus(),
        can_get_read_link=SharingAbilityStatus(),
    ):
        """
        :param SharingAbilityStatus can_add_new_external_principals:
        :param SharingAbilityStatus can_delete_edit_link:
        :param SharingAbilityStatus can_get_edit_link: Indicates whether the current user can get an existing tokenized
            sharing link that provides edit access.
        :param SharingAbilityStatus can_get_read_link: Indicates whether the current user can get an existing tokenized
            sharing link that provides read access.
        """
        self.canAddNewExternalPrincipals = can_add_new_external_principals
        self.canDeleteEditLink = can_delete_edit_link
        self.canDeleteManageListLink = can_delete_manage_list_link
        self.canGetEditLink = can_get_edit_link
        self.canGetReadLink = can_get_read_link

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

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

can_add_new_external_principals: A SharingAbilityStatus object indicating whether the current user can add new external principals (users outside the organization) to sharing links. Defaults to a new SharingAbilityStatus instance.

can_delete_edit_link: A SharingAbilityStatus object indicating whether the current user can delete existing tokenized sharing links that provide edit access. Defaults to a new SharingAbilityStatus instance.

can_delete_manage_list_link: A SharingAbilityStatus object indicating whether the current user can delete existing tokenized sharing links that provide manage list access. Defaults to a new SharingAbilityStatus instance.

can_get_edit_link: A SharingAbilityStatus object indicating whether the current user can retrieve an existing tokenized sharing link that provides edit access. Defaults to a new SharingAbilityStatus instance.

can_get_read_link: A SharingAbilityStatus object indicating whether the current user can retrieve an existing tokenized sharing link that provides read-only access. Defaults to a new SharingAbilityStatus instance.

Return Value

Instantiation returns a SharingLinkAbilities object that holds the sharing capabilities configuration. The entity_type_name property returns the string 'SP.Sharing.SharingLinkAbilities', which is used for SharePoint service communication and type identification.

Class Interface

Methods

__init__(self, can_add_new_external_principals=SharingAbilityStatus(), can_delete_edit_link=SharingAbilityStatus(), can_delete_manage_list_link=SharingAbilityStatus(), can_get_edit_link=SharingAbilityStatus(), can_get_read_link=SharingAbilityStatus())

Purpose: Initializes a new SharingLinkAbilities instance with the specified sharing capability statuses

Parameters:

  • can_add_new_external_principals: SharingAbilityStatus indicating if external principals can be added
  • can_delete_edit_link: SharingAbilityStatus indicating if edit links can be deleted
  • can_delete_manage_list_link: SharingAbilityStatus indicating if manage list links can be deleted
  • can_get_edit_link: SharingAbilityStatus indicating if edit links can be retrieved
  • can_get_read_link: SharingAbilityStatus indicating if read links can be retrieved

Returns: None (constructor)

@property entity_type_name(self) -> str property

Purpose: Returns the SharePoint entity type name for this class, used for service communication and type identification

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

Attributes

Name Type Description Scope
canAddNewExternalPrincipals SharingAbilityStatus Stores the ability status for adding new external principals to sharing links instance
canDeleteEditLink SharingAbilityStatus Stores the ability status for deleting edit-access sharing links instance
canDeleteManageListLink SharingAbilityStatus Stores the ability status for deleting manage-list-access sharing links instance
canGetEditLink SharingAbilityStatus Stores the ability status for retrieving existing edit-access sharing links instance
canGetReadLink SharingAbilityStatus Stores the ability status for retrieving existing read-only sharing links instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue
from office365.sharepoint.sharing.ability_status import SharingAbilityStatus

Usage Example

from office365.runtime.client_value import ClientValue
from office365.sharepoint.sharing.ability_status import SharingAbilityStatus
from office365.sharepoint.sharing.link_abilities import SharingLinkAbilities

# Create with default abilities (all disabled)
abilities = SharingLinkAbilities()

# Create with specific abilities
edit_status = SharingAbilityStatus()
read_status = SharingAbilityStatus()
abilities = SharingLinkAbilities(
    can_get_edit_link=edit_status,
    can_get_read_link=read_status
)

# Access the entity type name for SharePoint operations
entity_type = abilities.entity_type_name  # Returns 'SP.Sharing.SharingLinkAbilities'

# Access individual abilities
can_edit = abilities.canGetEditLink
can_read = abilities.canGetReadLink
can_add_external = abilities.canAddNewExternalPrincipals

Best Practices

  • This class is primarily a data container and should be instantiated with appropriate SharingAbilityStatus objects for each capability
  • The class uses camelCase for attribute names (canGetEditLink, etc.) to match SharePoint's API conventions, even though constructor parameters use snake_case
  • This class inherits from ClientValue, which means it's designed for serialization to/from SharePoint services - do not add complex logic or state management
  • Typically instantiated by SharePoint API responses rather than manually created by developers
  • All parameters have default values (new SharingAbilityStatus instances), so the class can be instantiated without arguments
  • The entity_type_name property is used internally by the Office365 library for type identification in SharePoint operations
  • This is an immutable-style data class - attributes are set during initialization and typically not modified afterward

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class SharingAbilities 89.1% similar

    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.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/abilities.py
  • class SharingLinkAccessRequest 80.8% 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 DirectSharingAbilities 80.3% 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 ShareLinkRequest 79.4% 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
  • class SharingAbilityStatus 77.4% 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
← Back to Browse