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);
});

https://i.sstatic.net/9ZinX.png https://i.sstatic.net/I9YeG.png https://i.sstatic.net/r6BKC.png

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: https://i.sstatic.net/IMgjT.png

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

What is the proper way to access the global `angular` variable in Angular and TypeScript when using AngularJS?

I'm currently integrating an Angular 4 component into a large monolithic AngularJS application. The challenge I face lies in the restrictions of the AngularJS project's build system, which limits me to only modifying the project's index.html ...

Establish a connection between a React variable and state management

In my codebase, I have an external module file named Task.ts. It contains the following: const taskList: Task[] = []; Class Task { ... } export { Task, taskList } The taskList is a list of Task objects that can be modified by the Task class. Now, i ...

The most secure method for retrieving User Id in AngularFire2

I'm currently facing a dilemma in determining the most secure method to obtain an authenticated user's uid using AngularFire2. There seem to be two viable approaches available, but I am uncertain about which one offers the best security measures ...

Guide to personalizing the ngxDaterangepickerMd calendaring component

I need to customize the daterangepicker library using ngxDaterangepickerMd in order to separate the start date into its own input field from the end date. This way, I can make individual modifications to either the start date or end date without affectin ...

Adding an active class on a selected chat list item in Angular - here's how!

We are currently developing a chat component where users can click on the left side chat item to open messages with the selected user. We have implemented an active class that changes the color of the selected chat list item. Our goal is to apply the activ ...

Why is my custom Vuelidate validator not receiving the value from the component where it is being called?

On my registration page, I implemented a custom validator to ensure that the password meets specific criteria such as being at least 12 characters long and containing at least one digit. However, I encountered an issue where the custom validator was not r ...

How do you handle an object of a specific type that can only be determined at runtime?

Here's a query I have: We're working on an ASP.NET web application that is designed to cater to multiple clients. The crucial aspect is the app's need to transform specific JSON strings into .NET object of type <T> so that it can be p ...

Can anyone offer any suggestions for this issue with Angular? I've tried following a Mosh tutorial but it's

Just finished watching a video at around 1 hour and 35 minutes mark where they added the courses part. However, I encountered an error during compilation. ../src/app/app.component.html:2:1 - error NG8001: 'courses' is not recognized as an elemen ...

Troubleshooting a TypeScript error when trying to access an imported service in Angular 2

I've been working on creating a form that allows users to input required details, which will trigger a server call and save the information. However, no matter what I try, I keep encountering the following error: ORIGINAL EXCEPTION: TypeError: this.po ...

Convert TypeScript-specific statements into standard JavaScript code

For my nextjs frontend, I want to integrate authentication using a keycloak server. I came across this helpful example on how to implement it. The only issue is that the example is in typescript and I need to adapt it for my javascript application. Being u ...

The type (string | undefined) cannot be assigned to type string[] even when using the .filter function to remove undefined elements

Consider the following code: let someVar: Array<string>; somevar = ["a", "b", undefined, "c"].filter((it) => !!it); The code above is resulting in an error: Type '(string | undefined)[]' is not assignable t ...

CPU usage spikes after launching a Cordova project in Visual Studio 2015 RTM

If you're looking for the source code of the project, you can find it at https://github.com/Yaojian/Ionic-TypeScript-Starter/. I decided to create a Visual Studio project by forking https://github.com/Justin-Credible/Ionic-TypeScript-Starter/ and fol ...

Keep an ear out for updates on object changes in Angular

One of my challenges involves a form that directly updates an object in the following manner: component.html <input type="text" [(ngModel)]="user.name" /> <input type="text" [(ngModel)]="user.surname" /> <input type="text" [(ngModel)]="use ...

Can you please provide the Typescript type of a route map object in hookrouter?

Is there a way to replace the 'any' type in hookrouter? type RouteMap = Record<string, (props?: any) => JSX.Element>; Full Code import { useRoutes, usePath, } from 'hookrouter' //// HOW DO I REPLACE any??? type RouteMap = ...

The output from Typescript Box results in a union type that is overly intricate to illustrate

Encountering an error while trying to render a Box: Received error message: Expression produces a union type that is too complex to represent.ts(2590) Upon investigation here, it seems that this issue arises from having both @mui/material and @react-thr ...

Recursive type analysis indicates that the instantiation of the type is excessively deep and may lead to potential infinite loops

In the process of developing a Jest utility, I have created a solution where an object mock is lazily generated as properties are accessed or called. Essentially, when a property is invoked like a method, it will utilize a jest.fn() for that specific path ...

Encountering an Object Type Unknown error while working with Typescript and React

I am currently working on building a chatbox in React using TypeScript and Firebase. Below is the code for my Room and Message components: function ChatRoom() { const messagesRef = firestore.collection('messages'); const query = messagesRef.o ...

Exploring Reactive Programming with RxJS and organizing data into individual streams

As I delve deeper into working reactively with Angular 15 and RxJS observables for a UI component, my focus lies on subscribing to data solely within the component template (html). The data is fetched from an external system through a service. However, a c ...

Utilize npm to compile TypeScript files as part of the npm build script execution

I am in the process of creating a build script using only npm, without relying on grunt or gulp. Most aspects are functioning well except for concatenating typescript files. While I can compile individual typescript files successfully, I am faced with th ...

Is there a way to implement error validation successfully in React Hook Form while utilizing template literals within the register function?

Utilizing React Hook Form along with Typescript, I am in the process of constructing a series of forms using a configuration object. Within this configuration object, there exists a key named prop which is of type string and is being passed to the register ...