[System Application] Add Message Headers blob and AddHeader/SetHeader/TryGetHeader on Email Message#8289
Draft
mynjj wants to merge 2 commits into
Draft
[System Application] Add Message Headers blob and AddHeader/SetHeader/TryGetHeader on Email Message#8289mynjj wants to merge 2 commits into
mynjj wants to merge 2 commits into
Conversation
Connectors that retrieve RFC822-style headers (e.g. the Outlook REST API
connector reading internetMessageHeaders from Graph) can now persist them
as JSON on the Email Message payload via two new methods on the Email
Message codeunit:
procedure SetHeaders(HeadersJson: JsonObject)
procedure TryGetHeader(HeaderName: Text; var Value: Text): Boolean
Storage is a new internal Blob field on table 8900. Header names are
expected lowercased; lookups are case-insensitive (key trimmed and
lowercased before comparison). Multi-value headers are concatenated with
#10 by convention. Empty input clears the blob.
This is purely additive -- no Email Connector interface version bump
(connectors signal headers availability by populating the blob, not by
implementing a new interface), no upgrade codeunit. Downstream consumers
(PA / e-doc connectors) read this to classify mail without re-hitting
the provider.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…tHeader primitives Encapsulate the storage convention (lowercase keys, repeated headers joined with #10) inside the Email Message codeunit rather than asking each caller to pre-normalize a JsonObject. Public surface is now: procedure AddHeader(HeaderName: Text; HeaderValue: Text) procedure SetHeader(HeaderName: Text; HeaderValue: Text) procedure TryGetHeader(HeaderName: Text; var Value: Text): Boolean AddHeader appends -- if a value already exists for that name it is joined with the new value via #10, preserving the order in which repeated headers like Received arrive. SetHeader replaces. Both normalize the name (trim + lowercase) before storing; lookups apply the same normalization, so callers don't have to. The internal Blob field on Email Message is unchanged. Storage is still JSON with lowercase keys, just no longer constructed by the caller. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
"Message Headers"Blob field toEmail Message(table 8900).Email Messagecodeunit (8904):AddHeader(HeaderName: Text; HeaderValue: Text)— appends; repeated names join with#10.SetHeader(HeaderName: Text; HeaderValue: Text)— replaces any existing value.TryGetHeader(HeaderName: Text; var Value: Text): Boolean— case-insensitive lookup.#10) is encapsulated inEmail Message Impl.so callers don't need to know the storage shape.No
Email Connectorinterface version bump and no upgrade codeunit — a connector signals "I supply headers" by populating the blob. Empty == "headers not supplied".The first commit lands the storage + an initial
SetHeaders(JsonObject)shape; the second swaps that to theAddHeader/SetHeader/TryGetHeaderprimitives so the convention stays inside the module. Squashable into one commit before merge if preferred.Motivated by the Payables Agent work that needs Graph's
internetMessageHeaders(Authentication-Results,X-MS-Exchange-Organization-AuthAs, …) reachable from downstream consumers without re-hitting Graph. The matching uptake in the Outlook REST API connector is in a sibling NAV PR.Test plan
EmailMessageHeadersTest(codeunit 134707) — four tests covering case-insensitive round-trip, missing-headers lookup, repeated-header#10join, andSetHeaderreplace semantics.Emailtest suite green (no regressions on the surroundingEmail MessageAPI).🤖 Generated with Claude Code