class SharingLinkKind
An enumeration-style class that defines constants representing different types of tokenized sharing links for objects, including direct links, organization access links, and anonymous access links with varying permission levels.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/links/kind.py
1 - 25
simple
Purpose
This class serves as a namespace for constants that categorize different kinds of sharing links in a system. It provides a standardized way to identify and differentiate between various sharing link types, including uninitialized states, direct links, organization-scoped links (view/edit), anonymous links (view/edit), and flexible tokenized links. This is typically used in document sharing, collaboration platforms, or any system that needs to manage different access levels and link types for shared resources.
Source Code
class SharingLinkKind:
def __init__(self):
"""Specifies the kind of tokenized sharing link"""
pass
Uninitialized = 0
"""Indicates the kind is indeterminate or that the value has not been initialized"""
Direct = 1
"""Indicates a direct link or canonical URL to an object"""
OrganizationView = 2
"""Indicates an organization access link with view permissions to an object"""
OrganizationEdit = 3
"""Indicates an organization access link with edit permissions to an object"""
AnonymousView = 4
"""Indicates an anonymous access link with view permissions to an object"""
AnonymousEdit = 5
"""Indicates an anonymous access link with edit permissions to an object"""
Flexible = 6
"""Indicates a tokenized sharing link where properties can change without affecting link URL"""
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
- | - |
Parameter Details
__init__: The constructor takes no parameters and performs no initialization. It exists only to provide a docstring explaining the class purpose.
Return Value
Instantiating this class returns a SharingLinkKind object, though the class is designed to be used via its class-level integer constants rather than through instance methods. The constants themselves are integers (0-6) representing different sharing link types.
Class Interface
Methods
__init__(self) -> None
Purpose: Initializes a SharingLinkKind instance, though instantiation is not the intended usage pattern
Returns: None - constructor returns a new instance but the class is designed for constant access
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
Uninitialized |
int | Value 0 - Indicates the kind is indeterminate or that the value has not been initialized | class |
Direct |
int | Value 1 - Indicates a direct link or canonical URL to an object | class |
OrganizationView |
int | Value 2 - Indicates an organization access link with view permissions to an object | class |
OrganizationEdit |
int | Value 3 - Indicates an organization access link with edit permissions to an object | class |
AnonymousView |
int | Value 4 - Indicates an anonymous access link with view permissions to an object | class |
AnonymousEdit |
int | Value 5 - Indicates an anonymous access link with edit permissions to an object | class |
Flexible |
int | Value 6 - Indicates a tokenized sharing link where properties can change without affecting link URL | class |
Usage Example
# Using class constants directly (recommended approach)
link_type = SharingLinkKind.OrganizationView
if link_type == SharingLinkKind.OrganizationView:
print("This is an organization view link")
# Checking for uninitialized state
if link_type == SharingLinkKind.Uninitialized:
print("Link kind not set")
# Using in a function to determine permissions
def get_permissions(link_kind):
if link_kind in [SharingLinkKind.OrganizationEdit, SharingLinkKind.AnonymousEdit]:
return "edit"
elif link_kind in [SharingLinkKind.OrganizationView, SharingLinkKind.AnonymousView]:
return "view"
elif link_kind == SharingLinkKind.Direct:
return "direct"
elif link_kind == SharingLinkKind.Flexible:
return "flexible"
else:
return "unknown"
permissions = get_permissions(SharingLinkKind.AnonymousEdit)
print(f"Permissions: {permissions}") # Output: Permissions: edit
Best Practices
- Use the class constants directly rather than instantiating the class (e.g., SharingLinkKind.OrganizationView)
- This class follows an enumeration pattern but predates Python's enum.Enum; consider using enum.IntEnum for new code
- The constants are integers, making them suitable for database storage and API serialization
- Always check for Uninitialized (0) state when validating link kinds
- The class is stateless and thread-safe since it only contains class-level constants
- Consider using these constants in switch/case statements or dictionaries for mapping link types to behaviors
- Document which link kinds are supported in your specific implementation, as not all systems may support all types
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class SharingLinkAbilities 72.1% similar
-
class SharingLinkData 70.1% similar
-
class ShareLinkSettings 69.7% similar
-
class SharingLinkInfo 69.6% similar
-
class SharingLinkAccessRequest 68.2% similar