🔍 Code Extractor

class EmailIdentity

Maturity: 41

A class representing the email identity of a user, extending the base Identity class with email-specific attributes.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/permissions/email_identity.py
Lines:
4 - 12
Complexity:
simple

Purpose

EmailIdentity is used to represent a user's identity in the context of email-based authentication or identification within the Office 365 directory system. It encapsulates the user's email address along with display name and ID inherited from the parent Identity class. This class is typically used when working with Office 365 directory permissions and user management where email is the primary identifier.

Source Code

class EmailIdentity(Identity):
    """Represents the email identity of a user."""

    def __init__(self, id_=None, email=None, display_name=None):
        """
        :param str email:
        """
        super(EmailIdentity, self).__init__(display_name, id_)
        self.email = email

Parameters

Name Type Default Kind
bases Identity -

Parameter Details

id_: Optional unique identifier for the identity. Can be None if not yet assigned. Typically a string representing a GUID or other unique identifier in the Office 365 system.

email: Optional email address string representing the user's email identity. This is the primary distinguishing attribute of this class. Should be a valid email format (e.g., 'user@example.com').

display_name: Optional human-readable name string for display purposes. This is passed to the parent Identity class and represents how the user's name should be shown in UI contexts.

Return Value

Instantiation returns an EmailIdentity object with the specified email, display_name, and id_ attributes. The object inherits all methods and attributes from the Identity base class.

Class Interface

Methods

__init__(self, id_=None, email=None, display_name=None)

Purpose: Initializes an EmailIdentity instance with optional id, email, and display_name

Parameters:

  • id_: Optional unique identifier string for the identity
  • email: Optional email address string for the user
  • display_name: Optional display name string for the user

Returns: None (constructor)

Attributes

Name Type Description Scope
email str or None The email address associated with this identity. Primary identifier for email-based user identification. instance
id_ str or None Unique identifier for the identity, inherited from parent Identity class instance
display_name str or None Human-readable display name for the identity, inherited from parent Identity class instance

Dependencies

  • office365

Required Imports

from office365.directory.permissions.identity import Identity
from office365.directory.identities.email_identity import EmailIdentity

Usage Example

from office365.directory.identities.email_identity import EmailIdentity

# Create an email identity with all parameters
email_identity = EmailIdentity(
    id_='12345-abcde-67890',
    email='john.doe@example.com',
    display_name='John Doe'
)

# Create with minimal parameters
basic_identity = EmailIdentity(email='jane.smith@example.com')

# Access attributes
print(email_identity.email)  # 'john.doe@example.com'
print(email_identity.display_name)  # 'John Doe'
print(email_identity.id_)  # '12345-abcde-67890'

Best Practices

  • Always provide a valid email address when creating an EmailIdentity instance, as this is the primary identifier
  • The id_ parameter should be unique within the Office 365 directory system if provided
  • Display name should be human-readable and suitable for UI display
  • This class is typically instantiated as part of larger Office 365 directory operations rather than standalone
  • All parameters are optional but at minimum the email should be provided for meaningful usage
  • The class inherits from Identity, so all parent class methods and attributes are available
  • Instances are typically used in read operations or as data transfer objects rather than for complex state management

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class Identity 76.5% similar

    The Identity class represents an identity of an actor (user, device, or application) in the Microsoft Office 365 API, storing display name and unique identifier information.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/permissions/identity.py
  • class ObjectIdentity 70.4% similar

    Represents an identity used to sign in to a user account, encapsulating sign-in type, issuer, and issuer-assigned identifier information.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/identities/object_identity.py
  • class EmailAddress 64.9% similar

    A data class representing an email address with an associated display name, inheriting from ClientValue for use in Office 365 API operations.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/outlook/calendar/email_address.py
  • class UserIdentity 64.0% similar

    A data class representing user identity information in the context of Azure AD audit logs, capturing details about users who initiated or were affected by audit activities.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/users/identity.py
  • class IdentityUserFlow 62.1% similar

    IdentityUserFlow is a minimal entity class that represents a user flow in an identity management system, inheriting all functionality from the Entity base class.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/identities/userflows/user_flow.py
← Back to Browse