🔍 Code Extractor

class SharingLinkDefaultTemplatesCollection

Maturity: 24

A collection class that manages a set of SharingLinkDefaultTemplate objects, providing a container for default sharing link templates in SharePoint.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/links/default_templates_collection.py
Lines:
8 - 10
Complexity:
simple

Purpose

This class serves as a specialized collection wrapper for managing multiple SharingLinkDefaultTemplate instances. It inherits from ClientValue, making it compatible with the Office365 SharePoint client library's serialization and communication mechanisms. The class is designed to hold and manage default templates used for creating sharing links in SharePoint, allowing for organized storage and retrieval of template configurations.

Source Code

class SharingLinkDefaultTemplatesCollection(ClientValue):
    def __init__(self, templates=None):
        self.templates = ClientValueCollection(SharingLinkDefaultTemplate, templates)

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

templates: Optional parameter that accepts an initial collection of SharingLinkDefaultTemplate objects or compatible data structures. Can be None (default), a list of SharingLinkDefaultTemplate instances, or any iterable that can be converted into a ClientValueCollection. When None, an empty collection is initialized.

Return Value

Instantiation returns a SharingLinkDefaultTemplatesCollection object containing a ClientValueCollection of SharingLinkDefaultTemplate objects. The collection is accessible via the 'templates' attribute and provides standard collection operations for managing sharing link templates.

Class Interface

Methods

__init__(self, templates=None)

Purpose: Initializes a new instance of SharingLinkDefaultTemplatesCollection with an optional initial set of templates

Parameters:

  • templates: Optional initial collection of SharingLinkDefaultTemplate objects or compatible data. Defaults to None, which creates an empty collection

Returns: None (constructor)

Attributes

Name Type Description Scope
templates ClientValueCollection[SharingLinkDefaultTemplate] A ClientValueCollection instance that stores and manages SharingLinkDefaultTemplate objects. Provides collection operations like add, remove, and iteration over the templates instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue
from office365.runtime.client_value_collection import ClientValueCollection
from office365.sharepoint.sharing.links.default_template import SharingLinkDefaultTemplate

Usage Example

from office365.sharepoint.sharing.links.default_template import SharingLinkDefaultTemplate
from office365.sharepoint.sharing.links.default_templates_collection import SharingLinkDefaultTemplatesCollection

# Create an empty collection
collection = SharingLinkDefaultTemplatesCollection()

# Create a collection with initial templates
template1 = SharingLinkDefaultTemplate()
template2 = SharingLinkDefaultTemplate()
initial_templates = [template1, template2]
collection_with_data = SharingLinkDefaultTemplatesCollection(templates=initial_templates)

# Access the templates collection
templates = collection_with_data.templates

# Add a new template to the collection
new_template = SharingLinkDefaultTemplate()
collection.templates.add(new_template)

Best Practices

  • Always initialize the collection before attempting to access or modify templates
  • Use the templates attribute to access the underlying ClientValueCollection for standard collection operations
  • When passing initial templates, ensure they are valid SharingLinkDefaultTemplate instances or compatible data structures
  • This class is designed to work within the Office365 SharePoint client library context and should be used with proper authentication
  • The collection inherits from ClientValue, making it serializable for SharePoint API communication
  • Do not directly modify the templates attribute; use ClientValueCollection methods for adding, removing, or updating templates

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class SharingLinkDefaultTemplate 91.3% similar

    A data class representing a default template for sharing links in SharePoint, containing link details information.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/links/default_template.py
  • class SharingAbilities 70.3% 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 ShareLinkRequest 70.2% 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 ShareLinkResponse 70.2% similar

    A response class that encapsulates information about a tokenized sharing link in SharePoint, including its retrieval or creation/update status.

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

    A collection class that manages and provides access to SharePoint list templates, extending EntityCollection to handle multiple ListTemplate instances.

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