🔍 Code Extractor

class OrgLabelsContextList

Maturity: 31

A client value class representing a paginated list of organizational labels contexts in SharePoint Portal, with support for tracking pagination state.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/portal/orglabels/context_list.py
Lines:
6 - 13
Complexity:
simple

Purpose

This class serves as a data container for organizational labels in SharePoint Portal. It encapsulates a collection of OrgLabelsContext objects along with pagination information, allowing clients to retrieve and manage organizational labels across multiple pages. It inherits from ClientValue, making it compatible with the Office365 REST API client framework for serialization and deserialization of SharePoint data.

Source Code

class OrgLabelsContextList(ClientValue):
    def __init__(self, is_last_page=None, labels=None):
        self.IsLastPage = is_last_page
        self.Labels = ClientValueCollection(OrgLabelsContext, labels)

    @property
    def entity_type_name(self):
        return "Microsoft.SharePoint.Portal.OrgLabelsContextList"

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

is_last_page: Optional boolean flag indicating whether this list represents the last page of results in a paginated response. When True, no more pages are available. When False or None, additional pages may exist.

labels: Optional collection or iterable of OrgLabelsContext objects representing the organizational labels. Can be None, a list, or any iterable that ClientValueCollection can process. These are the actual label data items for the current page.

Return Value

Instantiation returns an OrgLabelsContextList object with two attributes: IsLastPage (boolean or None) indicating pagination state, and Labels (ClientValueCollection of OrgLabelsContext objects) containing the label data. The entity_type_name property returns the string 'Microsoft.SharePoint.Portal.OrgLabelsContextList' for type identification in SharePoint API interactions.

Class Interface

Methods

__init__(self, is_last_page=None, labels=None)

Purpose: Initializes a new OrgLabelsContextList instance with pagination state and label collection

Parameters:

  • is_last_page: Optional boolean indicating if this is the last page of results
  • labels: Optional iterable of OrgLabelsContext objects to populate the Labels collection

Returns: None (constructor)

@property entity_type_name(self) -> str property

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

Returns: String 'Microsoft.SharePoint.Portal.OrgLabelsContextList' representing the SharePoint entity type

Attributes

Name Type Description Scope
IsLastPage bool or None Indicates whether this list represents the last page in a paginated result set. True means no more pages exist, False or None means more pages may be available. instance
Labels ClientValueCollection[OrgLabelsContext] A collection of OrgLabelsContext objects representing the organizational labels for the current page. Provides iterable access to individual label contexts. instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue
from office365.runtime.client_value_collection import ClientValueCollection
from office365.sharepoint.portal.orglabels.context import OrgLabelsContext

Usage Example

from office365.sharepoint.portal.orglabels.context import OrgLabelsContext
from office365.sharepoint.portal.orglabels.context_list import OrgLabelsContextList

# Create an empty labels list
labels_list = OrgLabelsContextList(is_last_page=False, labels=None)

# Create with existing label data
label1 = OrgLabelsContext()
label2 = OrgLabelsContext()
labels_list = OrgLabelsContextList(is_last_page=True, labels=[label1, label2])

# Access pagination state
if labels_list.IsLastPage:
    print('No more pages to fetch')

# Access the labels collection
for label in labels_list.Labels:
    # Process each OrgLabelsContext
    pass

# Get entity type name for API operations
entity_type = labels_list.entity_type_name

Best Practices

  • Always check the IsLastPage attribute before attempting to fetch additional pages of labels to avoid unnecessary API calls
  • The Labels attribute is a ClientValueCollection, which provides collection-like behavior for iterating over OrgLabelsContext objects
  • This class is typically instantiated by the Office365 library during deserialization of API responses rather than manually by users
  • When manually creating instances, ensure that the labels parameter contains valid OrgLabelsContext objects or None
  • The entity_type_name property is used internally by the Office365 framework for type resolution and should not typically be modified
  • This class is immutable after construction - attributes are set in __init__ and not modified thereafter
  • Use this class as part of pagination workflows when retrieving large sets of organizational labels from SharePoint

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class OrgLabelsContext 87.5% similar

    OrgLabelsContext is a client value class representing organizational labels context in SharePoint Portal, inheriting from ClientValue base class.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/portal/orglabels/context.py
  • class SharePointHomePageContext 64.7% similar

    A client value class representing the context for a SharePoint home page, used for serialization and communication with SharePoint Portal Home services.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/portal/home/page_context.py
  • class ListCollectionPosition 62.8% similar

    A client value class representing a position in a SharePoint list collection, used for pagination control when retrieving list items.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/lists/collection_position.py
  • class ListItemCollectionPosition 62.4% similar

    A class representing a collection position for SharePoint list items, used for pagination and tracking position within list item collections.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/listitems/collection_position.py
  • class GroupCreationContext 61.6% similar

    A client value class representing the context for creating a SharePoint group, inheriting from ClientValue base class.

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