---
id: object/codeunit/1681
type: object
title: Codeunit 1681 "Email Logging Management"
summary: Codeunit 1681 "Email Logging Management" in EmailLogging (Microsoft.CRM.EmailLoggin). 16 public procedures, 2 events, 3 event subscribers. Introduced in BC29, still in BC30.
tier: official
language: en
tags:
  - codeunit
  - emaillogging
versions:
  introduced: "29"
  last_changed: null
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: 4bfeb27460b8daf43b494c80a22d7288cf6e97e570180a1e2f939ffb1d2e65a2
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/EmailLogging/app/src/codeunits/EmailLoggingManagement.Codeunit.al
    title: src/Apps/W1/EmailLogging/app/src/codeunits/EmailLoggingManagement.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
object_type: codeunit
object_id: 1681
name: Email Logging Management
namespace: Microsoft.CRM.EmailLoggin
app: EmailLogging
extends: null
first_version: "29"
last_version: "30"
present_in:
  - "29"
  - "30"
changed_in: []
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 23
  events: 2
  subscribers: 3
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 8
  called_by: 5
  implements: 0
---

# Codeunit 1681 "Email Logging Management"

> Codeunit 1681 "Email Logging Management" in EmailLogging (Microsoft.CRM.EmailLoggin). 16 public procedures, 2 events, 3 event subscribers. Introduced in BC29, still in BC30.

EmailLogging · Microsoft.CRM.EmailLoggin · BC29-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/EmailLogging/app/src/codeunits/EmailLoggingManagement.Codeunit.al) · facts from BC29

## Properties

| Property | Value |
|---|---|
| Access | Internal |
| Permissions | tabledata "Email Logging Setup" = rimd |

## Events published

- `OnAfterInitializeAPIClient(var EmailLoggngAPIClient: interface "Email Logging API Client")` (internal)
- `OnAfterInitializeOAuthClient(var EmailLoggingOAuthClient: interface "Email Logging OAuth Client")` (internal)

## Event subscriptions

- HandleOnRegisterAssistedSetup subscribes to Codeunit "Guided Experience" OnRegisterAssistedSetup
- HandleOnBeforeSetStatusValue subscribes to Table "Job Queue Entry" OnBeforeSetStatusValue
- HandleOnRunEmailLoggingSetup subscribes to Page "Marketing Setup" OnRunEmailLoggingSetup

## Procedures

- `IsEmailLoggingEnabled(): Boolean` (internal)
- `CheckEmailLoggingEnabled()` (internal)
- `CheckEmailLoggingSetup()` (internal)
- `CheckInteractionTemplateSetup(): Boolean` (internal)
- `RegisterAssistedSetup(): Boolean` (internal)
- `ClearEmailLoggingSetup(var EmailLoggingSetup: Record "Email Logging Setup")` (internal)
- `CreateEmailLoggingJobQueueSetup()` (internal)
- `DeleteEmailLoggingJobQueueSetup()` (internal)
- `UpdateEmailLoggingJobQueueSetup()` (internal)
- `PromptClientCredentials(var ClientId: Text[250]; var ClientSecret: Text[250]; var RedirectURL: Text[2048]): Boolean` (internal)
- `ExtractTenantIdFromAccessToken(AccessToken: SecretText): Text` (internal)
- `TryExtractTenantIdFromAccessToken(var TenantId: Text; AccessToken: SecretText)` (internal)
- `InitializeAPIClient(var APIClient: interface "Email Logging API Client")` (internal)
- `InitializeOAuthClient(var OAuthClient: interface "Email Logging OAuth Client")` (internal)
- `LogActivityFailed(ActivityDescription: Text; ActivityMessage: Text)` (internal)
- `GetActivityLogRelatedRecordId(var RecordId: RecordId)` (internal)

Plus 2 local procedures.

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Codeunit 1990 "Guided Experience"](../codeunit/1990.md) (4 calls: `CheckEmailLoggingEnabled → Run`, `RegisterAssistedSetup → AddTranslationForSetupObjectTitle`, `RegisterAssistedSetup → Exists`, …)
- [Codeunit 1293 "Isolated Storage Management"](../codeunit/1293.md) (1 call: `ClearEmailLoggingSetup → Delete`)
- [Codeunit 43 "Language"](../codeunit/43.md) (1 call: `RegisterAssistedSetup → GetDefaultApplicationLanguageId`)
- [Codeunit 453 "Job Queue - Enqueue"](../codeunit/453.md) (1 call: `CreateEmailLoggingJobQueueSetup → (object)`)
- [Codeunit 501 "OAuth2"](../codeunit/501.md) (1 call: `PromptClientCredentials → GetDefaultRedirectURL`)
- [Codeunit 9179 "Application Area Mgmt. Facade"](../codeunit/9179.md) (1 call: `HandleOnRegisterAssistedSetup → IsBasicOnlyEnabled`)
- [Page 1613 "Exchange Client Credentials"](../page/1613.md) (1 call: `PromptClientCredentials → (object)`)
- [Page 1680 "Email Logging Setup"](../page/1680.md) (1 call: `HandleOnRunEmailLoggingSetup → (object)`)

## Called by

- [Codeunit 1684 "Email Logging API Helper"](../codeunit/1684.md) (6 calls: `GetMessages → LogActivityFailed`, `Initialize → InitializeAPIClient`, `Initialize → InitializeOAuthClient`, …)
- [Codeunit 1685 "Email Logging Invoke"](../codeunit/1685.md) (4 calls: `ArchiveMessage → LogActivityFailed`, `DeleteMessage → LogActivityFailed`, `LogMessageAsInteraction → LogActivityFailed`, …)
- [Page 1680 "Email Logging Setup"](../page/1680.md) (4 calls: `OnInit → InitializeOAuthClient`, `OnInit → RegisterAssistedSetup`, `SignInAndGiveAppConsent → ExtractTenantIdFromAccessToken`, …)
- [Page 1681 "Email Logging Setup Wizard"](../page/1681.md) (4 calls: `OnInit → InitializeOAuthClient`, `ShowDoneStep → CheckInteractionTemplateSetup`, `SignInAndGiveAppConsent → ExtractTenantIdFromAccessToken`, …)
- [Codeunit 1688 "Email Logging Upgrade"](../codeunit/1688.md) (1 call: `DisableEmailLoggingUsingEWS → RegisterAssistedSetup`)

## Across versions

- Present in: BC29-30
- Changed (declaration) in: none

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "Email Logging Management")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
