sivilian
sivilian

Reputation: 1473

Connecting to MSGraph API in Sharepoint Online WebPart project

I am trying to make a connect to MSGraph as described here:

https://learn.microsoft.com/en-us/sharepoint/dev/spfx/use-msgraph

On the line: .then((client: MSGraphClientV3): void I get a typescript datatype mismatch.

this.context.msGraphClientFactory
       .getClient('3')
       .then((client: MSGraphClientV3): void => {
         // use MSGraphClient here
       });

Argument of type '(client: MSGraphClientV3) => void' is not assignable to parameter of type '(value: MSGraphClientV3) => void | PromiseLike'. Types of parameters 'client' and 'value' are incompatible. Property '_consumerComponentManifest' is missing in type

I have version of Node v18.20.4 and SPfx ^1.18.2

Upvotes: 0

Views: 61

Answers (1)

RaytheonXie-MSFT
RaytheonXie-MSFT

Reputation: 39

Have you added the following import clause in your main web part file:

import { MSGraphClientV3 } from '@microsoft/sp-http';

You could refer to following document

https://learn.microsoft.com/en-us/sharepoint/dev/spfx/use-msgraph

Upvotes: 0

Related Questions