🔍 Code Extractor

class TenantInformation

Maturity: 50

A data class representing publicly displayed information about an Azure AD tenant, including domain name, display name, federation brand name, and tenant ID.

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

Purpose

This class serves as a data container (value object) for Azure AD tenant information that is publicly visible to users in other Azure AD tenants. It inherits from ClientValue, which likely provides serialization/deserialization capabilities for API communication. The class is used to encapsulate tenant metadata when interacting with Microsoft 365/Azure AD services through the Office365 Python SDK.

Source Code

class TenantInformation(ClientValue):
    """Information about your Azure AD tenant that is publicly displayed to users in other Azure AD tenants."""

    def __str__(
        self,
        default_domain_name=None,
        display_name=None,
        federation_brand_name=None,
        tenant_id=None,
    ):
        """
        :param str default_domain_name: Primary domain name of an Azure AD tenant.
        :param str display_name: Display name of an Azure AD tenant.
        :param str federation_brand_name: Name shown to users that sign in to an Azure AD tenant.
        :param str tenant_id: Unique identifier of an Azure AD tenant.
        """
        self.defaultDomainName = default_domain_name
        self.displayName = display_name
        self.federationBrandName = federation_brand_name
        self.tenantId = tenant_id

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

default_domain_name: The primary domain name of the Azure AD tenant (e.g., 'contoso.onmicrosoft.com'). This is the default domain used for user accounts in the tenant. Optional parameter, defaults to None.

display_name: The human-readable display name of the Azure AD tenant (e.g., 'Contoso Corporation'). This is shown in various Azure AD interfaces. Optional parameter, defaults to None.

federation_brand_name: The brand name shown to users during sign-in to the Azure AD tenant. This is typically used for federated authentication scenarios. Optional parameter, defaults to None.

tenant_id: The unique identifier (GUID) of the Azure AD tenant. This is a globally unique identifier that distinguishes this tenant from all others. Optional parameter, defaults to None.

Return Value

The __str__ method (which appears to be incorrectly named and should be __init__) returns None as it initializes the instance. When instantiated, the class returns a TenantInformation object with four instance attributes: defaultDomainName, displayName, federationBrandName, and tenantId. These attributes store the tenant information in camelCase format, likely for JSON serialization compatibility with Microsoft APIs.

Class Interface

Methods

__str__(self, default_domain_name=None, display_name=None, federation_brand_name=None, tenant_id=None) -> None

Purpose: Initializes the TenantInformation instance with Azure AD tenant details. NOTE: This method is incorrectly named and should be __init__. It sets up the instance attributes with tenant information.

Parameters:

  • default_domain_name: Primary domain name of the Azure AD tenant (e.g., 'contoso.onmicrosoft.com')
  • display_name: Display name of the Azure AD tenant shown in interfaces
  • federation_brand_name: Brand name shown to users during sign-in
  • tenant_id: Unique identifier (GUID) of the Azure AD tenant

Returns: None - this is a constructor-like method that initializes instance attributes

Attributes

Name Type Description Scope
defaultDomainName str or None The primary domain name of the Azure AD tenant instance
displayName str or None The display name of the Azure AD tenant instance
federationBrandName str or None The brand name shown to users during sign-in instance
tenantId str or None The unique identifier (GUID) of the Azure AD tenant instance

Dependencies

  • office365-runtime

Required Imports

from office365.runtime.client_value import ClientValue

Usage Example

from office365.runtime.client_value import ClientValue
from office365.directory.tenant_information import TenantInformation

# Create a TenantInformation instance with tenant details
tenant_info = TenantInformation()
tenant_info.__str__(
    default_domain_name='contoso.onmicrosoft.com',
    display_name='Contoso Corporation',
    federation_brand_name='Contoso',
    tenant_id='12345678-1234-1234-1234-123456789abc'
)

# Access tenant information
print(tenant_info.defaultDomainName)  # 'contoso.onmicrosoft.com'
print(tenant_info.displayName)  # 'Contoso Corporation'
print(tenant_info.tenantId)  # '12345678-1234-1234-1234-123456789abc'

# Typically used when retrieving tenant information from Azure AD
# tenant_info = context.tenant.get().execute_query()
# print(tenant_info.displayName)

Best Practices

  • NOTE: The method is named __str__ but behaves like __init__. This appears to be a bug in the source code. It should be renamed to __init__ for proper constructor behavior.
  • This class is a data container and should be treated as immutable after initialization. Avoid modifying attributes after creation.
  • The class uses camelCase for attribute names (defaultDomainName, displayName, etc.) to match Microsoft API conventions, even though Python typically uses snake_case.
  • When using this class, ensure tenant_id is a valid GUID format if provided.
  • This class inherits from ClientValue, which likely provides JSON serialization capabilities. The parent class may handle conversion between Python objects and API payloads.
  • Typically instantiated by the Office365 SDK when retrieving tenant information from Azure AD, rather than manually created by developers.
  • All parameters are optional (default to None), allowing partial tenant information to be represented.
  • The class does not perform validation on input values, so ensure data integrity at the caller level.

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class TenantAppInformation 75.9% similar

    A data class that represents information about a tenant-scoped application in Office 365, including its principal ID, web URL, and creation timestamp.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/tenant/apps/information.py
  • class TenantRelationship 68.9% similar

    A class representing tenant relationships in Azure AD, providing methods to query and validate tenant information across different Azure AD tenants.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/tenant_relationship.py
  • class ProvisionedTemporaryAzureContainerInfo 63.5% similar

    A data class representing provisioned temporary Azure container information, inheriting from ClientValue to provide serialization capabilities for Office 365 API interactions.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sites/azure_container_Info.py
  • class VerifiedDomain 62.7% similar

    A class representing a verified domain for a tenant in Microsoft 365/Office 365, inheriting from ClientValue to provide domain verification information.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/domains/verified.py
  • class SPOTenantWebTemplate 61.2% similar

    A client value class representing a SharePoint Online tenant web template in the Microsoft Online SharePoint Tenant Administration API.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/tenant/administration/webs/templates/template.py
← Back to Browse