0

I’m building a multi-provider email client that tracks sent/replied/forwarded messages. For Gmail, I can easily exclude specific messages from my tracking mechanism by adding a custom header (e.g., X-CRM-IGNORE) when sending/replying/forwarding via Gmail APIs.

Example:

X-CRM-IGNORE: true

This works perfectly and doesn’t break the thread.

However, for Outlook / Microsoft Graph API, I cannot find any way to add custom headers when replying or forwarding messages. Graph allows specifying recipients, body, attachments, etc., but not arbitrary Internet headers.

I need a way to mark certain messages (sent/replied/forwarded via Graph API) so they can be excluded from tracking.

This must not break the conversation/threading in Outlook or Graph.

Ideally, it should behave similar to Gmail’s X-CRM-IGNORE.

Questions:

Is there any way to add custom Internet headers (like X-CRM-IGNORE) when sending, replying, or forwarding messages via Microsoft Graph?

If not, what are the recommended alternatives to mark these messages so I can still identify and skip them later? (e.g., categories, extensions, message properties, etc.)

2 Answers 2

1

The message property you want is internetMessageHeaders. This collection is only editable when creating a message. Once a message has been delivered (i.e. recieved/sent/forwardws), it becomes read-only.

If you are looking to modify delivered messages then you will need to use Open Data Extension properties. Open extensions are designed to extend resources with application specific data. They are tied to your application, avoiding the risk of 3rd party inadvertently corrupting another applications data. This process is described in Add custom data to resources by using open extensions.

Sign up to request clarification or add additional context in comments.

Comments

0

You can try a singleValueLegacyExtendedProperty for outlook to sent custom key.

create key when send

 const replyMessage = {
            comment: comment
            message: {
                singleValueExtendedProperties: [
                    {
                        "id": "String {guid} Name Property-name",
                        "value": "String"
                    }
                ],
            }
        };

example guid: 66f5a359-4659-4830-9070-00040ec6ac6e

and on the event side you can fetch with expand.

const message = await this.graphClient
                .api(`/me/messages/${messageId}`)
                .expand("singleValueExtendedProperties($filter=id eq 'String {guid} Name X-CRM-IGNORE')")
                .get();

Hey here is the resources.

https://learn.microsoft.com/en-us/graph/api/singlevaluelegacyextendedproperty-post-singlevalueextendedproperties?view=graph-rest-1.0&tabs=javascript

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.