diff --git a/src/System Application/App/Azure AD Tenant/src/AzureADTenant.Codeunit.al b/src/System Application/App/Azure AD Tenant/src/AzureADTenant.Codeunit.al index daee266449..272eb75abc 100644 --- a/src/System Application/App/Azure AD Tenant/src/AzureADTenant.Codeunit.al +++ b/src/System Application/App/Azure AD Tenant/src/AzureADTenant.Codeunit.al @@ -37,5 +37,29 @@ codeunit 433 "Azure AD Tenant" begin exit(AzureADTenantImpl.GetAadTenantDomainName()); end; + + /// + /// Gets the current Microsoft Entra tenant registered country letter code. + /// Visit Microsoft Admin Cententer to view or edit Organizational Information. + /// If the Microsoft Graph API cannot be reached, the error is displayed. + /// + /// Country or region abbreviation for the organization in ISO 3166-2 format. + /// Cannot retrieve the Microsoft Entra tenant country letter code. + procedure GetCountryLetterCode(): Code[2]; + begin + exit(AzureADTenantImpl.GetCountryLetterCode()); + end; + + /// + /// Gets the current Microsoft Entra tenant registered preferred language. + /// Visit Microsoft Admin Cententer to view or edit Organizational Information. + /// If the Microsoft Graph API cannot be reached, the error is displayed. + /// + /// The preferred language for the organization. Should follow ISO 639-1 Code; for example, en. + /// Cannot retrieve the Microsoft Entra tenant preferred language. + procedure GetPreferredLanguage(): Code[2]; + begin + exit(AzureADTenantImpl.GetPreferredLanguage()); + end; } diff --git a/src/System Application/App/Azure AD Tenant/src/AzureADTenantImpl.Codeunit.al b/src/System Application/App/Azure AD Tenant/src/AzureADTenantImpl.Codeunit.al index a3f2b8de75..4b59162e0b 100644 --- a/src/System Application/App/Azure AD Tenant/src/AzureADTenantImpl.Codeunit.al +++ b/src/System Application/App/Azure AD Tenant/src/AzureADTenantImpl.Codeunit.al @@ -15,8 +15,12 @@ codeunit 3705 "Azure AD Tenant Impl." InherentPermissions = X; var + AzureADGraph: Codeunit "Azure AD Graph"; + TenantInfo: DotNet TenantInfo; NavTenantSettingsHelper: DotNet NavTenantSettingsHelper; TenantDomainNameErr: Label 'Failed to retrieve the Microsoft Entra tenant domain name.'; + CountryLetterCodeErr: Label 'Failed to retrieve the Microsoft Entra tenant country letter code.'; + PreferredLanguageErr: Label 'Failed to retrieve the Microsoft Entra tenant preferred language code.'; procedure GetAadTenantId() TenantIdValue: Text begin @@ -24,15 +28,36 @@ codeunit 3705 "Azure AD Tenant Impl." end; procedure GetAadTenantDomainName(): Text; - var - AzureADGraph: Codeunit "Azure AD Graph"; - TenantInfo: DotNet TenantInfo; begin - AzureADGraph.GetTenantDetail(TenantInfo); + Initialize(); if not IsNull(TenantInfo) then exit(TenantInfo.InitialDomain()); Error(TenantDomainNameErr); end; + + procedure GetCountryLetterCode(): Code[2]; + begin + Initialize(); + if not IsNull(TenantInfo) then + exit(CopyStr(TenantInfo.CountryLetterCode(), 1, 2)); + + Error(CountryLetterCodeErr); + end; + + procedure GetPreferredLanguage(): Code[2]; + begin + Initialize(); + if not IsNull(TenantInfo) then + exit(CopyStr(TenantInfo.PreferredLanguage(), 1, 2)); + + Error(PreferredLanguageErr); + end; + + local procedure Initialize() + begin + if IsNull(TenantInfo) then + AzureADGraph.GetTenantDetail(TenantInfo); + end; }