---
title: "Codeunit 1641 Setup Email Logging"
author: "Jonas Paprotka"
url: https://jonas-paprotka.de/ref/codeunit/1641-setup-email-logging/
type: codeunit
id: 1641
name: "Setup Email Logging"
app: "Base Application"
namespace: System.EMail
versions: "17-24"
build: 24.5.23489.36097
obsolete: "Pending 22.0"
checked: 2026-09-20
subject: "Microsoft Dynamics 365 Business Central"
license: "Content © 2026 Jonas Paprotka. Quote freely with attribution and a link."
---

# Codeunit 1641 Setup Email Logging

Jonas Paprotka, https://jonas-paprotka.de/ref/codeunit/1641-setup-email-logging/

| | |
| --- | --- |
| App | Base Application |
| Namespace | System.EMail |
| Versions | 17-24 |
| Obsolete | Pending 22.0, seen from 22. Feature EmailLoggingUsingGraphApi will be enabled by default in version 22.0 |
| Source file | SetupEmailLogging.Codeunit.al |

## Procedures

| Name | Parameters | Returns | Access | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- | --- |
| InitializeExchangePSConnection | () | Boolean | public | 17-19 | Pending 17.0 | Will be removed |
| CreatePublicFolders | (Text, Text, Text, Text) | Boolean | public | 17-19 | Pending 17.0 | Will be removed |
| CreateEmailLoggingRules | (Text, Text, Text) | Boolean | public | 17-19 | Pending 17.0 | Will be removed |
| ClearEmailLoggingSetup | (var Record Marketing Setup) | - | public | 17-24 | - | - |
| SetupEmailLoggingFolderMarketingSetup | (Text, Text, Text) | - | public | 17-19 | Pending 17.0 | Will be removed |
| GetExchangeFolder | (var Codeunit Exchange Web Services Client, var Record Exchange Folder, Text) | Boolean | public | 17-24 | - | - |
| GetDomainFromEmail | (Text) | Text | public | 17-24 | - | - |
| SetDeployCredentials | (Text[80], Text[30]) | - | public | 17-19 | Pending 17.0 | Will be removed |
| CreateEmailLoggingJobQueueSetup | () | - | public | 17-24 | - | - |
| DeleteEmailLoggingJobQueueSetup | () | - | public | 17-24 | - | - |
| ClosePSConnection | () | - | public | 17-19 | Pending 17.0 | End of support for Exchange Online PowerShell |
| PromptClientCredentials | (var Text[250], var Text[250], var Text[2048]) | Boolean | public | 17-24 | - | - |
| PromptAdminConsent | (var Text) | - | public | 17-24 | - | - |
| PromptAdminConsent | (Text, Text, Text, var Text) | - | public | 17-24 | - | - |
| GetClientCredentialsAccessToken | (Text, var Text) | - | public | 17-24 | Pending 24.0 | Use "GetClientCredentialsAccessToken(TenantId: SecretText; var AccessToken: SecretText)" instead. |
| GetClientCredentialsAccessToken | (Text, Text, Text, Text, var Text) | - | public | 17-24 | Pending 24.0 | Use "GetClientCredentialsAccessToken(ClientId: SecretText; ClientSecret: SecretText; RedirectURL: Text; TenantId: SecretText; var AccessToken: SecretText)" instead. |
| ExtractTenantIdFromAccessToken | (var Text, Text) | - | public | 17-24 | - | - |
| GetClientId | () | Text | public | 17-24 | - | - |
| GetClientSecret | () | Text | public | 17-24 | - | - |
| RegisterAssistedSetup | () | - | public | 17-24 | - | - |
| GetRedirectURL | () | Text | public | 17-24 | - | - |
| IsEmailLoggingUsingGraphApiFeatureEnabled | () | Boolean | internal | 20-24 | - | - |
| GetClientCredentialsAccessToken | (SecretText, var SecretText) | - | public | 24 | - | - |
| GetClientCredentialsAccessToken | (SecretText, SecretText, Text, SecretText, var SecretText) | - | public | 24 | - | - |

## Events

| Kind | Name | Parameters | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- |
| Integration event | OnGetEmailLoggingClientId | (var Text) | 17-24 | - | - |
| Integration event | OnGetEmailLoggingClientSecret | (var Text) | 17-24 | - | - |
| Integration event | OnGetEmailLoggingRedirectURL | (var Text) | 17-24 | - | - |

## Source

Symbols: Microsoft.BaseApplication.symbols.437dbf0e-84ff-417a-965d-ed2bb9650972, https://dynamicssmb2.pkgs.visualstudio.com/DynamicsBCPublicFeeds/_packaging/MSSymbols/nuget/v3/index.json, highest build per major on 2026-09-20.

Jonas Paprotka, 2026-09-20.
