0

Per this question: https://github.com/microsoftgraph/microsoft-graph-toolkit/issues/1224 I'm trying to set the headers on my request, but it seems the interfaces have changed (e.g. there is no longer a initWithMiddleware method on Client. This is in an SPFx project, fyi.

I'm trying the following in my web part onInit:

protected onInit(): Promise<void> {
        let provider = new SharePointProvider(this.context);

        const client = Client.init();
        client.api("v1.0").headers['X-PeopleQuery-QuerySources'] = 'Mailbox,Directory';
        provider.graph = new Graph(client as any);

        Providers.globalProvider = provider;


        return super.onInit();
    }

But it's not sending the headers.

Can anyone guide me on how to do this, if it's still possible?

Hilton Giesenow
  • 9,809
  • 2
  • 10
  • 24
  • Can you please check this document for more information on this:https://learn.microsoft.com/en-us/graph/toolkit/get-started/mgt-spfx – Mehtab Siddique Aug 01 '22 at 05:32
  • I've worked out why my code above obviously doesn't work, but the link you've sent doesn't help - it doesn't show how to set the headers. The issue, I've realised, is that in SPFx projects specifically, and older version of the Graph client libraries are loaded. I haven't tested with SPFx 1.15 yet. – Hilton Giesenow Aug 01 '22 at 09:28

0 Answers0