I am trying to use the Microsoft Graph Typescript SDK in a Vue Application that runs in an Outlook Task Pane. I followed the documentation. However, I run into an error when trying to get my own user via graph.
Using this code, I try to authenticate myself and get my own user as a test.
import { ClientSecretCredential } from "@azure/identity";
import { AzureIdentityAuthenticationProvider } from "@microsoft/kiota-authentication-azure";
import { createGraphServiceClient, GraphRequestAdapter } from "@microsoft/msgraph-sdk";
import "@microsoft/msgraph-sdk-users";
/*...*/
const credential = new ClientSecretCredential(
"...", //tenant
"...", //client-id
"...", //client-secret
);
const authProvider = new AzureIdentityAuthenticationProvider(credential);
const requestAdapter = new GraphRequestAdapter(authProvider);
const graphServiceClient = createGraphServiceClient(requestAdapter);
const myUser = await graphServiceClient.users.get();
console.log(myUser);
The users.get() fails with the following error:
Uncaught (in promise) Error: couldn't find adapter method
at send (apiClientProxifier.ts:180:13)
at Proxy.<anonymous> (apiClientProxifier.ts:227:26)
at MyPage.vue:34:49
at runtime-core.esm-bundler.js:2872:88
at callWithErrorHandling (runtime-core.esm-bundler.js:192:19)
at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:199:17)
at hook.__weh.hook.__weh (runtime-core.esm-bundler.js:2852:19)
at flushPostFlushCbs (runtime-core.esm-bundler.js:367:40)
at flushJobs (runtime-core.esm-bundler.js:405:5)
Any idea what I am doing wrong here?