Hi ,
Thanks for reaching out to Microsoft Q&A.
To extract attachments for a custom table in Business Central, the best practice is to leverage the standard Document Attachment framework instead of building a custom BLOB structure.
Link your custom table to the Document Attachment
table using the table ID and record key so attachments are stored consistently.
To export or download, read the attachment from the Document Attachment
record and stream it out.
For integrations, expose the attachments through a custom API page or extend the standard APIs, using Media or MediaSet fields for the file content.
If you already have a custom BLOB field, you can stream the content directly, but this is less maintainable and does not leverage native attachment features.
This approach ensures compatibility with standard UI, APIs, and future upgrades.
Best practices
- Reuse
Document Attachment
unless you have a very specific reason to maintain a separate BLOB structure.
Always handle InStream/OutStream to avoid loading large files into memory unnecessarily.
Add proper permissions to allow users or integrations to access attachment records.
For large integrations, consider batch APIs or Azure Blob Storage for offloading.
Please 'Upvote'(Thumbs-up) and 'Accept' as answer if the reply was helpful. This will be benefitting other community members who face the same issue.