The method Office.context.mailbox.item.internetHeaders.setAsync has not been configured

I am integrating the Microsoft Office API into Outlook. I'm attempting to add an extra x-header to my email in the composer scope for later identification. To achieve this, I referred to the following documentation: https://learn.microsoft.com/en-us/javascript/api/outlook/office.internetheaders?view=outlook-js-preview

Office.context.mailbox.item.internetHeaders.setAsync({"x-sap-mail-addin-id": this.state.addinMailId}, { 
  }, (assyRes) => {
    Office.context.mailbox.item.internetHeaders.getAsync(["x-sap-mail-addin-id"], { }, (val) => { 
      console.log(val);
    });
    console.log(assyRes);
});

Based on the screenshots, it appears that the value is currently being set. Subsequently, I attempted to retrieve the mail from MS Graph by:

var configuration = provider.GetService<ConfigurationService>();
var clientApp = ConfidentialClientApplicationBuilder
                    .Create(configuration.AzureAD.ApplicationId)
                    .WithTenantId(configuration.AzureAD.TenantId)
                    .WithClientSecret(configuration.AzureAD.AppSecret)
                    .Build();

var authProvider = new ClientCredentialProvider(clientApp);
var graphClient = new GraphServiceClient(authProvider);


var messageStream = await graphClient.Users["<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="48252921247a3b2938653b2d262c25292124082f213b2c2d3e66272625212b3a273b272e3c662b2725">[email protected]</a>"].Messages["AAMkADMzNDg3YTFiLWI4NDItNDI5Ni1hNzU1LTE3YmRhYjZkYzFjMwBGAAAAAABc2UL4pp4rRoxnwy3lWAHyBwAmKhkFHv2sRIc0wWWwSW0lAAAAAAEMAAAmKhkFHv2sRIc0wWWwSW0lAAAAAAlEAAA="].Content.Request().GetAsync();
var messageMetaData = await graphClient.Users["<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dbb6bab2b7e9a8baabf6a8beb5bfb6bab2b79bbcb2a8bfbeadf5b4b5b6b2b8a9b4a8b4bdaff5b8b4b6">[email protected]</a>"].Messages.Request().GetAsync();

I anticipated finding the header here:

However, neither the GUID nor the attribute name can be located within the entire message text, including the metadata retrieved from the graph.

What could possibly be incorrect in my approach?

EDIT: Below is the information obtained from the graph:

Received: from AM0PR09MB4036.eurprd09.prod.outlook.com (2603:10a6:208:19f::13)...

Answer №1

To retrieve internet headers for the message you are currently viewing in Read mode, it is necessary to utilize the item.getAllInternetHeadersAsync function. This API enables access to all internet headers associated with the item, allowing you to narrow down your search by filtering the asyncResult.value based on the specific header of interest.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The namespace does not contain any exported member

Every time I attempt to code this in TypeScript, an error pops up stating The namespace Bar does not have a member named Qux exported. What could possibly be causing this and how can I resolve it? class Foo {} namespace Bar { export const Qux = Foo ...

Issue: React cannot render Objects as children (received: [object Promise]). If you intended to display multiple children, please use an array instead. (Next)

My dilemma is this: I am trying to display my GitHub repositories on a React component, but I keep encountering the following error: Error: Objects are not valid as a React child (found: [object Promise]). If you meant to render a collection of children, u ...

Issue with MUI 5 Button component not receiving all necessary props

Currently, I am attempting to create a customized MUI5-based button in a separate component with the following code: import {Button, buttonClasses, ButtonProps, styled} from '@mui/material'; interface MxFlatButtonProps extends Omit<ButtonProp ...

Problem with timing in token interceptor and authentication guard due to injected service

Currently, I am facing an issue where I need to retrieve URLs for the auth service hosted on AWS by reading a config.json file. In order to accomplish this, I created a config service that reads the config file and added it as a provider in app.module. Eve ...

"Unindexing data in Angular: A step-by-step guide

Can someone help me figure out how to delete an item by index in Angular? I have a parameter and a remove button, but when I tried putting my parameter inside the remove button it didn't work. How can I fix this? deleteRowFiles(rowIndex: number){ th ...

Turning an array of strings into a multidimensional array

I have a JavaScript string array that I need to convert into a multidimensional array: const names = [ "local://john/doe/blog", "local://jane/smith/portfolio", "as://alexander/wong/resume" ]; The desired output sh ...

The Lenis smooth scrolling feature (GSAP) is not functioning properly

I have encountered an issue with the smooth scrolling feature of gsap causing a delay on my website. This problem is only resolved when I manually go into the browser settings and disable smooth scrolling by navigating to chrome://flags/#smooth-scrolling ...

Preventing an Angular component from continuing to execute after clicking away from it

At the moment, I have a sidebar with clickable individual components that trigger API calls to fetch data. However, I've noticed that even when I click off a component to another one, the old component continues to refresh the API data unnecessarily. ...

Ensure that the web application is successfully logged into using MSTest, and verify that the application is fully loaded before proceeding

I've encountered an issue while using MSTest in Visual Studio 2019 with Selenium. It seems that after logging in, Selenium struggles to locate an element on the dashboard. Upon further investigation, I discovered that my login method within the OneTim ...

Interface circular dependency is a phenomenon where two or more interfaces

In my MongoDB setup, I have created an interface that defines a schema using mongoose as an ODM. import mongoose, { model, Schema, Model, Document } from "mongoose"; import { IUser } from "./user"; import { IPost } from "./posts&q ...

What type of HTML tag does the MUI Autocomplete represent?

Having trouble calling a function to handle the onchange event on an autocomplete MUI element. I've tried using `e: React.ChangeEvent`, but I can't seem to locate the element for the autocomplete component as it throws this error: The type &apos ...

Reattempting a Promise in Typescript when encountering an error

I am currently working on a nodeJS application that utilizes the mssql driver to communicate with my SQL database. My goal is to have a unified function for retrieving a value from the database. However, in the scenario where the table does not exist upon ...

Discovering the base color using a hexadecimal color value in C#

When working with a Hex color code in C#, how can you determine if the color falls under the categories of Red, Green, Yellow, Pink, Orange, or Blue? ...

Struggling with CSS issues in ASP.NET 4.6

For the past few months, I've been diligently working on a project that suddenly hit a snag today. Upon inspecting my website, I noticed that all my button sizes appear to be uniform. I typically use Chrome's developer tools to troubleshoot my we ...

Troub3leshooting Circular Dependency with Typescript, CommonJS & Browserify

I am currently in the process of transitioning a rather substantial TypeScript project from internal modules to external modules. The main reason behind this move is to establish a single core bundle that has the capability to load additional bundles if an ...

Most effective methods for validating API data

Currently, I am working on developing an api using nestjs. However, I am facing some confusion when it comes to data validation due to the plethora of options available. For instance, should I validate data at the route level using schema validation (like ...

Eliminate the need for require statements in TypeScript-generated JavaScript files

I am working on a website project and utilizing TypeScript for development. While using the tsc compiler, I noticed that all my JavaScript code compiles correctly. However, when I include an import statement in my TypeScript files, it gets compiled into J ...

Utilizing Typescript with Angular 2 to efficiently convert JSON data into objects within HTTP requests

I am dealing with a file called location.json, which contains JSON data structured like this: { "locations": [ { "id": 1, "places": [ { "id": 1, "city": "A ...

The default value in an Ionic select dropdown remains hidden until it is clicked for the first time

Having an issue with my ion-select in Ionic version 6. I have successfully pre-selected a value when the page loads, but it doesn't show up in the UI until after clicking the select (as shown in pic 2). I'm loading the data in the ionViewWillEnt ...

Collaborative service involves objects passing through reference

I am encountering an issue with a shared service in angular. Upon application startup, the init function is triggered, fetching and returning data that is vital across the entire application. Components have the ability to inject this service and retrieve ...