🔍 Code Extractor

class AgreementAcceptance

Maturity: 40

Represents the current status of a user's response to a company's customizable terms of use agreement powered by Azure Active Directory (Azure AD).

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/identitygovernance/termsofuse/agreement_acceptance.py
Lines:
4 - 8
Complexity:
simple

Purpose

This class models an agreement acceptance entity in Microsoft 365/Azure AD environments. It tracks whether and when a user has accepted terms of use agreements. The class inherits from Entity, which likely provides base functionality for Microsoft Graph API entities including property management, serialization, and API interaction capabilities. It serves as a data model for managing compliance and legal agreement tracking within Azure AD-integrated applications.

Source Code

class AgreementAcceptance(Entity):
    """
    Represents the current status of a user's response to a company's customizable terms of use agreement powered by
    Azure Active Directory (Azure AD).
    """

Parameters

Name Type Default Kind
bases Entity -

Parameter Details

bases: Inherits from Entity class, which provides base functionality for Microsoft Graph API entities including property management, HTTP client context, and serialization capabilities

Return Value

Instantiation returns an AgreementAcceptance object that represents a user's agreement acceptance status. The object inherits Entity methods for interacting with Microsoft Graph API endpoints and managing entity properties such as agreement ID, user ID, acceptance timestamp, and agreement state.

Class Interface

Methods

__init__(context=None, **kwargs)

Purpose: Initializes an AgreementAcceptance entity instance, inheriting from Entity base class

Parameters:

  • context: Optional ClientContext for Microsoft Graph API communication
  • kwargs: Additional keyword arguments for entity properties

Returns: AgreementAcceptance instance

Attributes

Name Type Description Scope
agreement_id str The identifier of the agreement that was accepted instance
user_id str The identifier of the user who accepted the agreement instance
user_display_name str Display name of the user who accepted the agreement instance
user_principal_name str UPN (User Principal Name) of the user who accepted the agreement instance
recorded_date_time datetime The timestamp when the agreement was accepted instance
state str The state of the agreement acceptance (e.g., 'accepted', 'declined') instance
device_id str The identifier of the device used when accepting the agreement instance
device_display_name str Display name of the device used when accepting the agreement instance
device_os_type str Operating system type of the device used for acceptance instance
device_os_version str Operating system version of the device used for acceptance instance

Dependencies

  • office365

Required Imports

from office365.entity import Entity
from office365.directory.agreements.acceptance import AgreementAcceptance

Usage Example

from office365.runtime.auth.client_credential import ClientCredential
from office365.graph_client import GraphClient
from office365.directory.agreements.acceptance import AgreementAcceptance

# Authenticate with Azure AD
credentials = ClientCredential('client_id', 'client_secret')
client = GraphClient(credentials)

# Retrieve agreement acceptances for a user
user_id = 'user@example.com'
acceptances = client.users[user_id].agreement_acceptances.get().execute_query()

# Iterate through acceptances
for acceptance in acceptances:
    print(f"Agreement ID: {acceptance.agreement_id}")
    print(f"Accepted on: {acceptance.recorded_date_time}")
    print(f"State: {acceptance.state}")

# Access specific acceptance
acceptance_id = 'acceptance-guid'
acceptance = client.users[user_id].agreement_acceptances[acceptance_id].get().execute_query()
print(f"User display name: {acceptance.user_display_name}")

Best Practices

  • Always authenticate properly with Azure AD before attempting to access AgreementAcceptance entities
  • Ensure your application has the necessary Microsoft Graph API permissions (Agreement.Read.All or Agreement.ReadWrite.All)
  • Use execute_query() to materialize data from the API after building queries
  • Handle API rate limits and implement retry logic for production applications
  • Cache agreement acceptance data when appropriate to reduce API calls
  • The class is read-only in most scenarios; agreement acceptances are typically created through Azure AD portal or user consent flows
  • Always check for None values when accessing properties as not all fields may be populated
  • Use proper error handling when querying agreement acceptances as users may not have any acceptances recorded

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class Agreement 83.9% similar

    Represents a tenant's customizable terms of use agreement managed within Azure Active Directory (Azure AD).

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/identitygovernance/termsofuse/agreement.py
  • class TermsOfUseContainer 72.3% similar

    A container class that provides access to Azure Active Directory's terms of use API, exposing relationships for managing agreements and agreement acceptances.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/identitygovernance/termsofuse/container.py
  • class AppConsentRequest 60.4% similar

    Represents a user's request to a tenant admin for consent to access an app or grant permissions to an app, used in Microsoft Graph API identity governance workflows.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/identitygovernance/appconsent/request.py
  • class UserConsentRequest 60.3% similar

    Represents a user consent request for accessing an app or granting permissions when admin authorization is required in an admin consent workflow.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/identitygovernance/userconsent/request.py
  • class IdentityGovernance 58.9% similar

    A singleton container class that provides access to Azure Active Directory identity governance features including access reviews, entitlement management, app consent, and terms of use.

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