🔍 Code Extractor

class SharingCapabilities

Maturity: 43

An enumeration-style class that defines external sharing capability levels for SharePoint site collections in Office 365.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/tenant/administration/sharing_capabilities.py
Lines:
1 - 17
Complexity:
simple

Purpose

This class serves as a constants container (enum-like) to represent different external sharing settings available for SharePoint site collections in Office 365. It defines four distinct sharing capability levels that control how external users and guests can access shared content. The class is used to configure or check sharing permissions on SharePoint sites, determining whether external user sharing via email and guest link sharing are enabled or disabled.

Source Code

class SharingCapabilities:
    """External sharing settings on a SharePoint site collection in Office 365"""

    def __init__(self):
        pass

    Disabled = 0
    """External user sharing (share by email) and guest link sharing are both disabled."""

    ExternalUserSharingOnly = 1
    """External user sharing (share by email) is enabled, but guest link sharing is disabled."""

    ExternalUserAndGuestSharing = 2
    """External user sharing (share by email) and guest link sharing are both enabled."""

    ExistingExternalUserSharingOnly = 3
    """Only guests already in your organization's directory."""

Parameters

Name Type Default Kind
bases - -

Parameter Details

__init__: The constructor takes no parameters and performs no initialization. It exists only to allow instantiation of the class, though the class is primarily used for its class-level constants rather than instances.

Return Value

Instantiating this class returns a SharingCapabilities object with no instance state. The primary value comes from accessing the class-level integer constants (Disabled=0, ExternalUserSharingOnly=1, ExternalUserAndGuestSharing=2, ExistingExternalUserSharingOnly=3) that represent different sharing capability levels.

Class Interface

Methods

__init__(self)

Purpose: Initializes a SharingCapabilities instance (though instantiation is not typically necessary for this constants class)

Returns: None

Attributes

Name Type Description Scope
Disabled int Constant value 0 indicating that both external user sharing (share by email) and guest link sharing are disabled class
ExternalUserSharingOnly int Constant value 1 indicating that external user sharing (share by email) is enabled, but guest link sharing is disabled class
ExternalUserAndGuestSharing int Constant value 2 indicating that both external user sharing (share by email) and guest link sharing are enabled class
ExistingExternalUserSharingOnly int Constant value 3 indicating that sharing is limited to only guests already in the organization's directory class

Usage Example

# Typically used to access constants directly from the class
from sharing_capabilities import SharingCapabilities

# Access sharing capability constants
sharing_level = SharingCapabilities.Disabled
print(sharing_level)  # Output: 0

# Check sharing settings
if current_sharing == SharingCapabilities.ExternalUserAndGuestSharing:
    print("Both external user and guest sharing enabled")

# Set sharing capability on a SharePoint site
site.sharing_capability = SharingCapabilities.ExternalUserSharingOnly

# Can also instantiate (though not typically necessary)
capabilities = SharingCapabilities()
print(capabilities.ExternalUserSharingOnly)  # Output: 1

Best Practices

  • Use the class constants directly without instantiation (e.g., SharingCapabilities.Disabled) as this is an enum-like pattern
  • Do not modify the class-level constant values as they represent fixed SharePoint sharing capability levels
  • Use these constants when configuring SharePoint site collection sharing settings to ensure valid values
  • Consider using Python's enum.IntEnum instead for better type safety and IDE support in modern implementations
  • The integer values (0-3) correspond to SharePoint's internal sharing capability enumeration
  • When comparing sharing settings, use the named constants rather than raw integers for code readability

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class ExternalSharingSiteOption 77.9% similar

    A constants class that defines string options for external sharing site permissions in SharePoint or similar collaboration platforms.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/external_site_option.py
  • class SharingAbilities 74.5% 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 DirectSharingAbilities 74.4% 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 SharingLinkAbilities 71.8% 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 SharingAbilityStatus 71.6% 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