---
id: object/codeunit/8751
type: object
title: Codeunit 8751 "DA External Storage Impl."
summary: Codeunit 8751 "DA External Storage Impl." in External Storage - Document Attachments (Microsoft.ExternalStorage.DocumentAttachments). 18 public procedures, 9 event subscribers. Introduced in BC29, still in BC30.
tier: official
language: en
tags:
  - codeunit
  - external storage - document attachments
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: 112ba637d20396675738d59c95aa56b939b24eeaa7376a7e452ff95471d54b38
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/External%20Storage%20-%20Document%20Attachments/app/src/DocumentAttachmentIntegration/DAExternalStorageImpl.Codeunit.al
    title: src/Apps/W1/External Storage - Document Attachments/app/src/DocumentAttachmentIntegration/DAExternalStorageImpl.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/10828
    - change/bcapps/10055
object_type: codeunit
object_id: 8751
name: DA External Storage Impl.
namespace: Microsoft.ExternalStorage.DocumentAttachments
app: External Storage - Document Attachments
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: 35
  events: 0
  subscribers: 9
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 7
  called_by: 1
  implements: 1
---

# Codeunit 8751 "DA External Storage Impl."

> Codeunit 8751 "DA External Storage Impl." in External Storage - Document Attachments (Microsoft.ExternalStorage.DocumentAttachments). 18 public procedures, 9 event subscribers. Introduced in BC29, still in BC30.

External Storage - Document Attachments · Microsoft.ExternalStorage.DocumentAttachments · BC29-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/External%20Storage%20-%20Document%20Attachments/app/src/DocumentAttachmentIntegration/DAExternalStorageImpl.Codeunit.al) · facts from BC29

## Properties

| Property | Value |
|---|---|
| Access | Internal |
| Permissions | tabledata "Tenant Media" = rimd, tabledata "Document Attachment" = rimd, tabledata "File Account" = r, tabledata "DA External Storage Setup" = r |

## Event subscriptions

- OnAfterInsertDocumentAttachment subscribes to Table "Document Attachment" OnAfterInsertEvent
- OnAfterDeleteDocumentAttachment subscribes to Table "Document Attachment" OnAfterDeleteEvent
- DocumentAttachment_OnBeforeExportToStream subscribes to Table "Document Attachment" OnBeforeExportToStream
- DocumentAttachment_OnBeforeGetAsTempBlob subscribes to Table "Document Attachment" OnBeforeGetAsTempBlob
- DocumentAttachment_OnBeforeGetContentType subscribes to Table "Document Attachment" OnBeforeGetContentType
- DocumentAttachment_OnBeforeHasContent subscribes to Table "Document Attachment" OnBeforeHasContent
- Document Attachment_OnInsertOnBeforeCheckDocRefID subscribes to Table "Document Attachment" OnInsertOnBeforeCheckDocRefID
- Document Attachment Mgmt_OnCopyAttachmentsOnAfterSetToDocumentFilters subscribes to Codeunit "Document Attachment Mgmt" OnCopyAttachmentsOnAfterSetToDocumentFilters
- Document Attachment_OnBeforeOpenInOneDrive subscribes to Table "Document Attachment" OnBeforeOpenInOneDrive

## Procedures

- `BeforeAddOrModifyFileScenarioCheck(Scenario: Enum "File Scenario"; Connector: Enum "Ext. File Storage Connector"): Boolean`: Called before adding or modifying a file scenario.
- `GetAdditionalScenarioSetup(Scenario: Enum "File Scenario"; Connector: Enum "Ext. File Storage Connector"): Boolean`: Called to get additional setup for a file scenario.
- `BeforeDeleteFileScenarioCheck(Scenario: Enum "File Scenario"; Connector: Enum "Ext. File Storage Connector"): Boolean`: Called before deleting a file scenario.
- `BeforeReassignFileScenarioCheck(Scenario: Enum "File Scenario"): Boolean`
- `UploadToExternalStorage(var DocumentAttachment: Record "Document Attachment"): Boolean`: Provides functionality to manage document attachments in external storage systems. Handles upload, download, and deletion operations for Business Central attachments.
- `DownloadFromExternalStorage(var DocumentAttachment: Record "Document Attachment"): Boolean`: Downloads a document attachment from external storage and prompts user to save it locally.
- `DownloadFromExternalStorageToInternal(var DocumentAttachment: Record "Document Attachment"): Boolean`: Downloads a document attachment from external storage and saves it to internal storage.
- `DownloadFromExternalStorageToStream(ExternalFilePath: Text; var AttachmentOutStream: OutStream): Boolean`: Downloads a document attachment from external storage to a stream.
- `DownloadFromExternalStorageToTempBlob(ExternalFilePath: Text; var TempBlob: Codeunit "Temp Blob"): Boolean`: Downloads a document attachment from external storage to a Temp Blob.
- `DeleteFromExternalStorage(var DocumentAttachment: Record "Document Attachment"): Boolean`: Deletes a document attachment from external storage.
- `DeleteFromInternalStorage(var DocumentAttachment: Record "Document Attachment"): Boolean`: Deletes a document attachment from internal storage.
- `FileExtensionToContentMimeType(var Rec: Record "Document Attachment"; var ContentType: Text[100])`: Maps file extensions to their corresponding MIME types.
- `IsFileUploadedToExternalStorageAndDeletedInternally(var DocumentAttachment: Record "Document Attachment"): Boolean`: Checks if a Document Attachment file is uploaded to external storage and not stored internally.
- `SelectRootFolder(): Text`: Opens a folder selection dialog for choosing the root folder.
- `GetCurrentEnvironmentHash(): Text[32]`: Gets the current environment hash for use in folder structure.
- `IsFileFromAnotherEnvironmentOrCompany(DocumentAttachment: Record "Document Attachment"): Boolean`: Checks if a file belongs to another environment or company.
- `MigrateFileToCurrentEnvironment(var DocumentAttachment: Record "Document Attachment"): Boolean`: Migrates a file from a previous environment or company folder to the current one.
- `RunCompanyMigration(): Integer`: Runs migration for all document attachments from a previous company.

Plus 8 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 9454 "External File Storage"](../codeunit/9454.md) (20 calls: `DeleteExternalFile → DeleteFile`, `DeleteExternalFile → Initialize`, `DownloadFromExternalStorage → GetFile`, …)
- [Codeunit 9452 "File Scenario"](../codeunit/9452.md) (10 calls: `BeforeAddOrModifyFileScenarioCheck → GetSpecificFileAccount`, `DeleteExternalFile → GetSpecificFileAccount`, `DownloadFromExternalStorage → GetSpecificFileAccount`, …)
- [Codeunit 8754 "DA Feature Telemetry"](../codeunit/8754.md) (7 calls: `DeleteExternalFile → LogFileDeleted`, `DocumentAttachment_OnBeforeExportToStream → LogFileDownloadFailed`, `DocumentAttachment_OnBeforeGetAsTempBlob → LogFileDownloadFailed`, …)
- [Codeunit 4100 "Temp Blob"](../codeunit/4100.md) (5 calls: `DownloadFromExternalStorageToTempBlob → CreateOutStream`, `MigrateFileToCurrentEnvironment → CreateInStream`, `MigrateFileToCurrentEnvironment → CreateOutStream`, …)
- [Codeunit 1266 "Cryptography Management"](../codeunit/1266.md) (1 call: `GetCurrentEnvironmentHash → GenerateHash`)
- [Codeunit 27 "Confirm Management"](../codeunit/27.md) (1 call: `BeforeAddOrModifyFileScenarioCheck → GetResponseOrDefault`)
- [Codeunit 457 "Environment Information"](../codeunit/457.md) (1 call: `GetCurrentEnvironmentHash → GetEnvironmentName`)

## Called by

- [Page 8750 "DA External Storage Setup"](../page/8750.md) (2 calls: `OnOpenPage → GetCurrentEnvironmentHash`, `SelectRootFolder → SelectRootFolder`)

## Implements

- [Codeunit 9452 "File Scenario"](../codeunit/9452.md)

## Recent changes

- 2026-09-15 [#10828 Avoid remote attachment checks during FactBox refresh](../../changes/bcapps/10828.md) (main, BC30, performance)
- 2026-08-17 [#10055 Fix: migrating a document attachment deletes shared Tenant Media](../../changes/bcapps/10055.md) (main, BC30, fix)

## 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: "DA External Storage Impl.")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
