🔍 Code Extractor

class PickerEntityInformation

Maturity: 45

A class representing additional information about a principal (user, group, or security entity) in SharePoint's people picker system.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/ui/applicationpages/peoplepicker/entity_information.py
Lines:
7 - 27
Complexity:
simple

Purpose

This class serves as a data container for retrieving and accessing metadata about SharePoint principals, particularly useful when working with the people picker UI component. It provides access to information such as the total member count for groups and the underlying entity details. The class inherits from ClientObject, indicating it's part of the Office365 SharePoint client library and represents a server-side object that can be queried and manipulated through the SharePoint REST API.

Source Code

class PickerEntityInformation(ClientObject):
    """Represents additional information about the principal."""

    @property
    def total_member_count(self):
        """
        The count of members in a group. Valid when the principal is a SharePoint group or a security group.
        :rtype: int
        """
        return self.properties.get("TotalMemberCount", None)

    @property
    def entity(self):
        """
        The principal for which information is being requested.
        """
        return self.properties.get("Entity", PickerEntityInformationRequest())

    @property
    def entity_type_name(self):
        return "SP.UI.ApplicationPages.PickerEntityInformation"

Parameters

Name Type Default Kind
bases ClientObject -

Parameter Details

__init__: The constructor parameters are inherited from ClientObject base class. Typically accepts a context object and optional resource path for connecting to SharePoint services.

Return Value

Instantiation returns a PickerEntityInformation object that provides read-only access to principal information through properties. The properties return specific data types: total_member_count returns an integer (or None), entity returns a PickerEntityInformationRequest object, and entity_type_name returns a string identifying the SharePoint entity type.

Class Interface

Methods

@property total_member_count(self) -> int property

Purpose: Returns the count of members in a group, valid only when the principal is a SharePoint group or security group

Returns: Integer representing the total number of members in the group, or None if not applicable or not loaded

@property entity(self) -> PickerEntityInformationRequest property

Purpose: Returns the principal entity for which information is being requested

Returns: A PickerEntityInformationRequest object representing the underlying principal entity

@property entity_type_name(self) -> str property

Purpose: Returns the SharePoint entity type name for this object

Returns: String constant 'SP.UI.ApplicationPages.PickerEntityInformation' identifying the SharePoint entity type

Attributes

Name Type Description Scope
properties dict Inherited from ClientObject, stores the property values loaded from SharePoint server including TotalMemberCount and Entity instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_object import ClientObject
from office365.sharepoint.ui.applicationpages.peoplepicker.entity_information_request import PickerEntityInformationRequest

Usage Example

from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.ui.applicationpages.peoplepicker.entity_information import PickerEntityInformation

# Assuming you have a ClientContext set up
ctx = ClientContext(site_url).with_credentials(credentials)

# Typically obtained from a people picker query result
entity_info = PickerEntityInformation(ctx)
ctx.load(entity_info)
ctx.execute_query()

# Access properties
member_count = entity_info.total_member_count
if member_count is not None:
    print(f"Group has {member_count} members")

# Access the underlying entity
entity = entity_info.entity
type_name = entity_info.entity_type_name
print(f"Entity type: {type_name}")

Best Practices

  • This class is typically not instantiated directly by users but rather obtained as a result of people picker queries or principal resolution operations
  • Always check if total_member_count is None before using it, as it's only valid for SharePoint groups and security groups
  • The class is read-only; it provides access to server-side data but doesn't support modification
  • Ensure proper SharePoint context is established before attempting to load or access properties
  • Use ctx.load() and ctx.execute_query() pattern to populate the object's properties from the server
  • The entity property returns a PickerEntityInformationRequest object which may need additional loading to access its full data

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class PickerEntityInformationRequest 77.2% similar

    A data transfer object (DTO) class that represents a request for retrieving picker entity information in SharePoint, encapsulating principal identification parameters.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/ui/applicationpages/peoplepicker/entity_information_request.py
  • class ClientPeoplePickerWebServiceInterface 71.5% similar

    A SharePoint web service interface class that provides static methods for querying and resolving principals (users, groups) using the People Picker functionality.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/ui/applicationpages/peoplepicker/web_service_interface.py
  • class ObjectSharingInformationUser 71.5% similar

    A class representing information about a principal (user or group) with whom a SharePoint securable object is shared, providing access to their email, SIP address, login name, and related principal/user objects.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/object_sharing_information_user.py
  • class PickerSettings 68.3% similar

    Configuration settings class for the SharePoint client people picker control, providing access to picker behavior settings and query configurations.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/picker_settings.py
  • class SharePointSharingSettings 68.1% similar

    A class representing SharePoint UI-specific sharing settings, providing access to people picker properties and other sharing-related configurations.

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